输入用户名和密码,判断是否登录成功,重试次数为3次

1、输入用户名和密码,判断是否登录成功,重试次数为3次

_username = 'alren'
_password = 'alren'
for i in range(3):
    username = input('please input your name: ')
    password = input('please input your password: ')
    if username == _username and password == _password:
        print('login success....')
    else:
        print('your password or username is not correct')
print('-------------------------------------------------')

for i in range(3):
username = input('please input your name: ')
password = input('please input your password: ')
if username == _username and password == _password:
print('login success....')
elif username == _username and password != _password:
print('password is error')
elif username != _username and password == _password:
print('username is error')
else:
print('your password or username is not correct')

猜你喜欢

转载自www.cnblogs.com/alrenn/p/12533373.html