初始python

1.猜数字游戏,三次后提醒是否继续

current_num = 33

count=0
while True:
    if count>=3:
        print("是否继续?yorYorNor n")
        answer=input("y or n")
        if answer in ('Y','y'):
            count=0
            continue
        else:
            break
    x=input("input a number:")

    x= int(x)

    if x>current_num:
        print("猜大了,请继续:")
    elif x<current_num:
        print("猜小了,请继续:")
    else:
        print("right!")
        break
    count+=1

  

posted @ 2019-06-14 20:46  evan0925  阅读(132)  评论(0编辑  收藏  举报