循环判断

_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("你的用户或密码被锁定")
posted @ 2022-05-30 17:22  Mis168  阅读(35)  评论(0)    收藏  举报