码迷,mamicode.com
首页 > 编程语言 > 详细

python 课堂笔记-while

时间:2017-09-18 13:22:56      阅读:267      评论:0      收藏:0      [点我收藏+]

标签:字母   col   wan   python   time   trie   bigger   confirm   big   

#Author:zyl

age_of_oldboy = 56
count = 0
while count < 3:
    guess_age = int(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:
        countine_confirm = input("do you want  to keep guess")
        if  countine_confirm != n:     #可以随便指定一个字母n或者a
            count =0  #计数器复位,重新计数
else:
    print("you have  tried  too many  times...fuck off")

 

python 课堂笔记-while

标签:字母   col   wan   python   time   trie   bigger   confirm   big   

原文地址:http://www.cnblogs.com/leon-zyl/p/7542480.html

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