一个简单的python实现登录以及修改密码的函数
#密码错误3次,锁定登录:
password_list = [*#*#,\]
def account_login():
Tries = 3
while Tries > 0:
pwd = input(Please input you password:)
password_correct = pwd == password_list[-1]
password_reset = pwd == password_list[0]
if password_correct:
print (Login success!)
elif password_reset:
New_password = input(Please input a New password!)
password_list.append(New_password)
print (password changed successfully!)
account_login()
else:
print (Wrong password or invalid input!)
Tries = Tries - 1
print (Tries, imes lift!)
else:
print (You accout have suspended!)
account_login()
输入*#*#修改密码