我将随机进行 3 个问题的有趣测验,并提供 3 次猜测的机会。
在我尝试执行后,我尝试了正确的答案,但一直循环并告诉我的答案不正确并且无法停止循环,我不知道为什么......
谁能帮我看看?
q1 = 'What can one catch that is not thrown?'
a1 = 'A cold'
q2 = 'If you had only one match and entered a dark room containing an oil lamp, some kindling wood, and a newspaper, which would you light first?'
a2= 'The match'
q3 = 'Some months have 31 days, others have 30 days, but how many have 28 days?'
a3= 'All the months'
import random
quizzes = [q1, q2, q3] #catagorise to quizzes
for answer in random.choice(quizzes):
guesses = 3 # limits to 3 guesses
random.choice(quizzes)
asking = input('Your Answer is?\n')
if quizzes == q1 and asking == 'A cold':
print( 'Bingo!!')
break
elif quizzes == q2 and asking == 'The match':
print( 'Bingo!!')
break
elif quizzes == q3 and asking == 'All the months':
print( 'Bingo!!')
break
elif guesses == 0:
print( 'Sorry, you are reached the maximum guesses. Bye~now~')
else:
guesses -= 1 #reducing the max. guesses of 3 to 2 to 1
print( "Sorry, it's incorrect.")
result = asking