password_list = ['*#*#', '12345']
def account_login():
password = input('请输入密码:')
password_correct = password == password_list[-1]
password_reset = password == password_list[0]
if password_correct:
print('登陆成功')
elif password_reset:
new_password = input('请重置密码:')
password_list.append(new_password)
print('密码重置成功')
account_login()
else:
print('密码输入错误')
account_login()
account_login()
-------------------------------------
密码输入错误时elif 语句不运行,比如:12
直接跳过elif ,
P.S. 不管式自己写的还是,从网上copy的都一样。
def account_login():
password = input('请输入密码:')
password_correct = password == password_list[-1]
password_reset = password == password_list[0]
if password_correct:
print('登陆成功')
elif password_reset:
new_password = input('请重置密码:')
password_list.append(new_password)
print('密码重置成功')
account_login()
else:
print('密码输入错误')
account_login()
account_login()
-------------------------------------
密码输入错误时elif 语句不运行,比如:12
直接跳过elif ,
P.S. 不管式自己写的还是,从网上copy的都一样。