python3.5模擬登錄要求:python
一、三次登錄認證;spa
二、輸入正確--->歡迎;code
三、輸入錯誤--->密碼或帳戶有誤;blog
四、若是想繼續--->選擇y或Y。input
思路:class
一、建立帳戶和密碼;python3.5
二、用while循環,count計數;循環
三、輸入正確時,跳出循環(break);密碼
四、擋count=3時,要從新計數(count置0)。di
count = 0 age = 22 while count < 3: user_guess = int(input("you guess:")) if user_guess == age : print("you are right!") break elif user_guess < age : print("try bigger") else : print("try smaller") count += 1 if count == 3 : choice = input("please choice?:(y|Y):") if choice == 'y' or choice == 'Y': count = 0