Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- userDatabase = {}
- validation = True
- while validation == True:
- print ("Create a username. Or, type 'cancel' to cancel.") #Why does it still print this after a
- password passes validation and is added to the dictionary?
- username = input()
- if username == 'cancel':
- break
- if username.isalnum() == True:
- if username in userDatabase.keys():
- print ()
- print ("***Error***: Username not available.")
- print ()
- else:
- userDatabase.setdefault(username,"")
- print ("Now please create a password")
- while True:
- password = input()
- if password.isalnum() == True:
- userDatabase[username] = password
- validation == False
- break
- else:
- print ("Please enter a valid password using letters and numbers only.")
- else:
- print ()
- print ("Error: Invalid.")
- print ()
- print(userDatabase)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement