循环判断
_username = 'Zero'
_password = '123'
counter = 0
while counter < 3:
username = input("用户:")
password = input("密码:")
if username == _username and password == _password:
print("认证成功")
break
else:
print("用户或密码,错误")
counter += 1
if counter == 3:
user_input = input("请问还玩嘛?Y/n:")
if user_input == 'Y':
counter = 0
else:
print("你的用户或密码被锁定")

浙公网安备 33010602011771号