pass_wds = {"admin": "123321", "user1": "123456"}
input_password_number = 1
user_name = input("请输入用户名:")
while user_name not in pass_wds:
user_name = input("请输入正确的用户名:")
user_password = input("请输入密码:")
while user_password != pass_wds[user_name]:
print("密码输入错误,您还有{0}次机会,请重新输入!".format(3-input_password_number))
user_password = input("请重新输入密码:")
input_password_number += 1
if input_password_number < 3:
continue
else:
break
if user_password == pass_wds[user_name]:
print("登陆成功!")
else:
print("您已超过密码输入次数,请稍后再试!!")