The end result of this is to allow a user to log in and/or register themselves for a dice game. Please post some suggestions for improvement.
import pickle logged_in = False with open('users.pickle', 'rb') as a_file: users = pickle.load(a_file) login_or_signup = input('do you want to login or signup? ') # sign up (creating new account) if login_or_signup.lower() == "signup": create_username = input("enter a new username: ") create_password = input("enter a new password (Your password cannot be the same as your username !!!!!!!): ") if create_password in users: create_password = input("password taken re-enter: ") users[create_username] = create_password username = input('please enter username: ') if username in users: password = input("enter password: ") if password == users[username]: print("access granted") logged_in = True else: print("access denied") with open("users.pickle", 'wb') as f: pickle.dump(users, f, pickle.HIGHEST_PROTOCOL)