from cubroid import led, sound, master, light_touch_sensor, sleep # Машина-викторина: отвечай Да/Нет касанием questions = [ "В1: 1+1=2?", "В2: 3>5?", "В3: Python — язык программирования?", ] answers = [True, False, True] score = 0 for i in range(len(questions)): print(f"\n{questions[i]}") led.text(f"Q{i+1}", 0.3) sleep(1) print("Касание=Да, Без касания=Нет (3 сек)") master.yellow() touched = False for t in range(30): if light_touch_sensor.is_pressed(): touched = True sleep(0.1) correct = (touched == answers[i]) if correct: score = score + 1 master.green() sound.play("high_do") led.face("happy") print("Верно!") else: master.red() sound.play("do") led.face("sad") print("Неверно!") sleep(1) led.off() master.off() print(f"\nИтоговый счёт: {score}/{len(questions)}")