操作测验

时间:2016-10-13 21:00:20

标签: python operators

我正在进行操作测验并且我已经开始工作了但是没有办法告诉用户他们输入了错误的答案,它只是继续下一个。

import random
name=(input("What is your Name?: "))
operator=(input("What operation would you like?"))
if operator=="+":
        for i in range(0,10):
            x=random.randint(0,100)
            y=random.randint(0,100)
            Ans=int(x)+int(y)
            print(x," + ",y," =")
            studentAns=int(input())
        if studentAns==Ans:
                print("Correct")
                count=count+1
                score=score+1
        else:
            print("Incorrect the correct answer is",ans)

0 个答案:

没有答案