005_while

#!/usr/bin/env python
# Author:liujun

age=56
count=0
while count < 3:
guessage = int(input("guess age:")) #Data type conversion is needed.
if guessage == age:
print("yes you got it")
break;
elif guessage > age:
print("bigger")
else:
print("smaller")
count += 1
else:
print("you have tried too many times...fuck off")

# while ... else is special grammar in python


原文地址:https://www.cnblogs.com/liujun5319/p/9578349.html