name = input('What is your name?')
print('Welcome to my quiz', name)
guess = 0
tries = 0
answer = 5
score = 0
while guess != answer and tries < 2:
guess = input('10/2 is...')
if guess == answer:
print("Correct")
score = score + 10
else:
print("Incorrect")
score = score - 3
tries = tries + 1
guess = 0
tries = 0
answer = 25
while guess != answer and tries < 2:
guess = input('5*5 is...')
if guess == answer:
print('Correct')
score = score + 10
else:
print('Incorrrect')
score = score - 3
tries = tries + 1
print ('Thank you for playing',name)
我遇到的問題是,當我測試代碼時,每當我回答問題時,即使答案正確,打印也不正確。我正在做一個測驗,但每次我測試測驗和答案,它說不正確,我不知道爲什麼?
1.''While'!='while''和2.''5'!= 5' - 'input'總是一個字符串*。 – jonrsharpe