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