猜年龄做个循环

age=36
guessage=int(input('Please guess my age:'))
while guessage!=age:
    if guessage<age:
        print('you need bigger')
        guessage=int(input('Please guess my age again:'))
    elif guessage>age:
        print('you need smaller')
        guessage=int(input('Please guess my age again:'))
else:print('you got it')
View Code

 



#出现过的错误是在循环的时候没有重新赋值。
posted @ 2017-11-22 11:25  xusuns  阅读(106)  评论(1编辑  收藏  举报