import random as r print("答对一道题,得1分,答错减3分,达到一百分胜利.") fraction = 0 while True: num1 = r.randint(0,10) num2 = r.randint(0,10) num3 = num1 * num2 print(num1,'*',num2) num4 = int(input('=')) if num4 == num3: fraction+=1 print("答对了","分数:",fraction) elif num4 !=num3: fraction-=3 print("答错了","分数:",fraction) if fraction >= 100: print("恭喜你,过关了.") break