python 课堂笔记-while

时间:2017-09-18 13:11:57   收藏:0   阅读:291
#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")

 

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!