0

I'm trying to make a quiz game for my kid so I'm using a lot of 'if, elif, else' statements. I want to use multiple choice answers in the list [] but I always get a 'wrong' answer. single variables are working but I can't use a list. the second elif statement ignores the list. Here is an example of one of the questions:

question_1 = "What is the capital city of Canada? "
print(question_1)

while True:
    answer = input('').lower()
    if answer == "toronto":
        print("Close but it's not Toronto. Try again please.")
    elif answer == ['otawa', 'otwa', 'otawo']
        print("You are right but your spelling is a bit wrong. Try again ")
    elif answer == 'ottawa':
        print(correct_ans)
        break
    else:
        print(wrong_ans)
Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128
  • Rather than your == operator, I think you want to use "in" like elif answer in ['otawa', 'otwa'... – Ben Sep 24 '22 at 21:49

0 Answers0