#登录带重置密码功能
password_list = ['*#*#','12345']defaccount_login():
tries= 3
while tries >0: #while-else结构
password= input('Password:')
password_correct= password == password_list[-1]
password_reset= password ==password_list[0]ifpassword_correct:print('Login success!')elifpassword_reset:
new_password= input('Enter a new password:')
password_list.append(new_password)print('Your password has changed successfully!')
account_login()else:print('Wrong password or invalid input!')
tries= tries - 1
print(tries,'times left')else:print('Your account has been suspended') #suspended:暂停
account_login()