2019年4月17日 星期三

guess review

def check_guess(ans,guess):
    guessing=True
    temp=0
    while (guessing  and temp<3):
        if (ans==guess):
            print("you are right")
            guessing=False
        else:
            print("repeat again")
            guess=input("yonr answer is")
            temp=temp+1
    if (temp==3):
        print("the answer is %s" % (ans))

guess01=input("who is the most smart in the wrorld ? ")
check_guess("up",guess01)

沒有留言:

張貼留言