Python(模拟用户三次登录机会)

# Author: Sooele

for i in range(1,4):
    user_name=input('请输入用户名')
    user_pwd=input('请输入pwd')
    if user_name=='admin' and user_pwd=='admin':
        print('登录成功')
        break
    else:
        print('用户名密码不正常')
        if i<3:
            print(f'你还有{3-i}次机会')
else:
    print('对不起,三次均错误')