【发布时间】:2015-03-02 11:16:12
【问题描述】:
错误在第 10 行。不知道它为什么会崩溃。等号一旦运行就会以红色突出显示。 代码如下:
import random
question = 1
correct = 0
while question < 10:
a = random.randint(1, 12)
b = random.randint(1, 12)
answer = input(a, 'x', b, '=')
if 'answer' = 'a*b':
print ('correct!')
correct = correct+1
else:
print ('Incorrect\nthe correct answer was', a*b)
print ('You got', correct, 'out of 10 correct')
【问题讨论】: