码迷,mamicode.com
首页 > 其他好文 > 详细

猜年龄---while循环

时间:2017-07-17 00:34:04      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:input   oldboy   keep   tin   env   bigger   utf-8   confirm   and   

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

age_of_oldboy = 56

count =0
while count <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!")
count +=1
if count ==3:
continue_confirm = raw_input("do you want to keep guessing...")
if continue_confirm != ‘n‘:
count = 0
else:
print("you have tried many times....fuck off")

猜年龄---while循环

标签:input   oldboy   keep   tin   env   bigger   utf-8   confirm   and   

原文地址:http://www.cnblogs.com/andychen520/p/7192358.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!