python 课堂笔记-while
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 课堂笔记-while相关的知识,希望对你有一定的参考价值。
#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的主要内容,如果未能解决你的问题,请参考以下文章