输入用户名和密码,判断是否登录成功,重试次数为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')
_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....') break 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....') break 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')

浙公网安备 33010602011771号