python入门学习Day1

在视频学习下,自己尝试编写的猜年龄小程序,运用到if和loop。
my_age=26
count=0
while count < 4:
guess_age=int(input('please input your guess age:'))
if guess_age == my_age:
print ('you are right!congratulation!')
exit()
elif guess_age < my_age:
print ('you think too smaller!')
else:
print('you think too higher!')
count += 1
else:
print('you try too many times,you lose!')

猜你喜欢

转载自www.cnblogs.com/hqsecxqq/p/10495736.html