Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. userDatabase = {}
  2. validation = True
  3. while validation == True:
  4. print ("Create a username. Or, type 'cancel' to cancel.") #Why does it still print this after a
  5. password passes validation and is added to the dictionary?
  6. username = input()
  7. if username == 'cancel':
  8. break
  9. if username.isalnum() == True:
  10. if username in userDatabase.keys():
  11. print ()
  12. print ("***Error***: Username not available.")
  13. print ()
  14. else:
  15. userDatabase.setdefault(username,"")
  16. print ("Now please create a password")
  17. while True:
  18. password = input()
  19. if password.isalnum() == True:
  20. userDatabase[username] = password
  21. validation == False
  22. break
  23. else:
  24. print ("Please enter a valid password using letters and numbers only.")
  25. else:
  26. print ()
  27. print ("Error: Invalid.")
  28. print ()
  29.  
  30. print(userDatabase)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement