首页 > 代码库 > 猜年龄---for循环

猜年龄---for循环

#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Andy Chen

age_of_oldboy = 56

for i in range(3):
guess_age = int(raw_input("guess age:"))
if guess_age == age_of_oldboy:
print("yes,you got it")
break
elif guess_age > age_of_oldboy:
print("think smaller....")
else:
print("think bigger!")
else:
print("you have tried many times....fuck off")

猜年龄---for循环