给你改了一下,一共有三处错误
两处是在log_in函数,一处是在new_user函数logIn = {}
def new_user():
while True:
name = input("请输入用户名:")
password = input("请输入密码:")
logIn[name] = password
print("注册成功,请登录")
break
menu()
def log_in():
while True:
name = input("请输入用户名:")
if name not in logIn:
print("您输入的用户名不存在")
break
else:
password = input("请输入密码")
pwd = logIn.get(name)
if password == pwd:
print("登录成功")
break
else:
print("密码错误")
break
break
def menu():
while True:
print("|---新建用户:N/n---|")
print("|---登录账号:E/e---|")
print("|---退出程序:Q/q---|")
order = str(input("|---请输入指令代码:"))
if order == "N" or order == "n":
new_user()
elif order == "E" or order == "e":
log_in()
elif order == "Q" or order == "q":
break
break
menu()
|