I am making a quiz in python that has all the questions and answers in a dictionary. Everything works well but the problem is that I don't know how to put or in a dictionary. I tried to make it that if the user types "7" or "seven"
(as the answer) the code prints correct
but it doesn't. What happens is that if the user types 7 it says correct but if the user types seven (in letters) it says incorrect although seven is correct. I have done research on this but I couldn't find anything.
Here's the code. The dictionary variable is called Question_list. Also take note that the questions in the dictionary are on the left side of the : and the answers are on the right side of the :
import random
Question_list = {
"How many days are there in a year?":"365" or "three hundred and sixty five",
"How many hours are there in a day?":"24" or "twenty four",
"How many days are there in a week?":"7" or "seven"
}
#The part which asks the questions and verifies if the answer the user does is correct or incorrect. It also randomizes the questions
score = 0
question = list (Question_list.keys())
#input answer here
while True:
if not question:
break
ques = random.choice(question)
print(ques)
while True:
answer = input('Answer ' )
# if correct, moves onto next question
if answer.lower() == Question_list[ques]:
print("Correct Answer")
break
else:
#if wrong, Asks the same question again
print("Wrong Answer, try again")
question.remove(ques)