My goal is to get the inputs from users to go into a text file so that the users will be saved. I would really appreciate it if someone could help me. Thank you!
users = {}
login = ""
def menu():
login = input("Do you have a registered account(yes/no)? ")
if login == 'yes':
olduser()
elif login == 'no':
newuser()
def newuser():
createlogin = input("create a username: ")
if createlogin in users:
print("\nThis username is taken\n")
else:
createpassword = input("create a password: ")
users[createlogin] = createpassword
print("\nUser created\n")
def olduser():
login = input("Enter login name: ")
passw = input("Enter password: ")
if login in users and users[login] == passw:
print("\nLogin successful!\n")
elif login == "administrator":
print("\nLogin successful!\n")
print(users)
else:
print("\nUser doesn't exist or wrong password\n")
while login != "q":
menu()