猜年龄---while循环
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Andy Chen
age_of_oldboy = 56
count = 0
while count <3:
guess_age = int(input("please input your number:"))
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..")
count += 1
if count == 3:
continue_confirm = input("do you want to keep guessing...")
if continue_confirm != 'n':
count = 0
else:
print("you have tried man times keep guess...fuck you!")

浙公网安备 33010602011771号