age=36guessage=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‘) #出现过的错误是在循环的时候没有重新赋值。
时间: 2024-11-09 09:34:11