python 課堂筆記-while
阿新 • • 發佈:2017-09-18
code 計數器 指定 blog ldb tin == confirm auth
#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