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')