Top.Mail.Ru
Ответы
Аватар пользователя
Аватар пользователя
Аватар пользователя
Аватар пользователя
Программирование
+2

Помогите с заданием Python

Помогите пожалуйста с заданием

Задача сделать шуточного голосового помощника

import random

vopros1 = input("Введите вопрос \n-->")
vopros2 = input("Введите вопрос \n-->")
vopros3 = input("Введите вопрос \n-->")

answersForQuestion1 = ['1', '2', '3']
answersForQuestion2 = ['11', '22', '33']
answersForQuestion3 = ['111', '222', '333']

answer1 = random.choice(answersForQuestion1)
answer2 = random.choice(answersForQuestion2)
answer3 = random.choice(answersForQuestion3)

while True:
if vopros1==input():
print(answer1)
elif vopros2==input():
print(answer2)
elif vopros3==input():
print(answer3)
break

выдает ошибку в строке с vopros ами

По дате
По рейтингу
Аватар пользователя
Мастер
12345678910111213141516171819202122232425
 import random 
 
vopros1 = input("Введите вопрос n-->") 
vopros2 = input("Введите вопрос n-->") 
vopros3 = input("Введите вопрос n-->") 
 
answersForQuestion1 = ['1', '2', '3'] 
answersForQuestion2 = ['11', '22', '33'] 
answersForQuestion3 = ['111', '222', '333'] 
 
answer1 = random.choice(answersForQuestion1) 
answer2 = random.choice(answersForQuestion2) 
answer3 = random.choice(answersForQuestion3) 
 
while True: 
    question = input("Задайте вопрос:n") 
    if question == vopros1: 
        print(answer1) 
    elif question == vopros2: 
        print(answer2) 
    elif question == vopros3: 
        print(answer3) 
    else: 
        print("Неизвестный вопрос. Попробуйте снова.") 
#По идее так, но не уверен правильно ли понял ваше ТЗ