username = "taibai" password = "123" i = 0 while i < 3: name = input('请输入你的用户名:') pwd = input('请输入你的密码:') if username == name and password == pwd: print("您登录成功") break else: print("登录失败,您还有%d次登录机会" %(2-i)) if (2-i) == 0: result = input("是否还想在试试? Yes") if result == "Yes": i = 0 continue i += 1 else:print("要不要验你")