前言
Python学习while-else语句、if语句循环,实现guess的判断。
代码:
oldboy_age = 66
count = 0
while count<3:
guess_age = int(input("guess age:"))
if guess_age == oldboy_age:
print("yes,you got it!")
break
elif guess_age > oldboy_age:
print("you guess too bigger !")
else:
print("you guess too smaller !")
count += 1
if count == 3:
print("You have tried too many times...")
continue_config = input("Do you want to continue?...")
if continue_config != 'n':
count = 0
else:
print("You have tried too many times...")
[本文地址]http://blog.youkuaiyun.com/u011463646/article/details/77050639