我对Python很陌生。在学校,我们必须创建一个数学游戏,我正在创建一个9倍的桌面游戏。但是,即使它是正确的,它告诉我答案是不正确的?请帮忙!
import random
print(" Hello there!")#prints hello there
print("What is your name?")#asks user for a name
name= input()#sets name to the input
print(name, ", are you ready to test your nine times table? ")#asks user if they are ready to test their 9 times table
print (name, ", here we go!")#prints here we go
print ("Question 1:")#prints Question 1:
number1 = random.randint(1,12)#sets number1 to a random value from 1 to 12
answer= 9*number1#sets answer to 9 times number1
print ("what is 9 times", number1, "?")#asks what is 9 times number 1
if answer==input():
print ("well done," , name,"thats correct!")
else:
print("sorry, the correct answer was", answer, )