day02代码
1.while.....else.....语句,break,continue,if,while,用户交互,输出,运算符
# 用户有三次登录机会 _username = 'tom' _password = 'abc123' count = 1 while count <= 3: name = input("请输入用户名:") password = input("请输入密码:") if name == _username and password == _password: print("登录成功") break else: print("请再试一次,还剩%s机会!" % (3-count)) # 提示用户还剩几次机会 if count == 3: choice = input("如果想再次尝试,需要输入?Yes") if choice == 'Yes' or choice == 'yes': # 如果choice值为True或False,count值为1 count = 1 continue else: pass count += 1 else: print("不要脸")