Advertisement
Guest User

Untitled

a guest
Feb 7th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. # Copy and paste your `validate_password` function here
  2. def validate_password(password):
  3. # Inside the function, check if the password is longer than 6 characters long
  4. if (len(password) > 6):
  5. return True
  6. else:
  7. return False
  8.  
  9. # Create a function called `collect_user_information` that will prompt the user for their username, password, and email address. It should return this information in a list that contains those three values.
  10.  
  11. def collect_user_information():
  12.  
  13. # Prompt the user for their username and store it in a variable called username
  14. username = input("What's your username? ")
  15.  
  16. # Prompt the user for their email and store it in a variable called email
  17.  
  18.  
  19. # Prompt the user for their password and store it in a variable called password
  20.  
  21.  
  22. # Create a list that will store all of the user data collected inside of it and call it user_info
  23.  
  24.  
  25. # Return the above list (called user_info)
  26.  
  27.  
  28. # Create a function called `create_user` that checks if the password entered is valid.
  29. def create_user(user_data):
  30. username = user_data[0]
  31. email = user_data[1]
  32. password = user_data[2]
  33.  
  34. # Use your `validate_password` function to check if the password is secure
  35. if validate_password(password):
  36. # If yes, create a dictionary, called `user` with the keys "Username", "Email", and "Password" and associate these keys with the values the user entered
  37.  
  38.  
  39.  
  40.  
  41.  
  42. # When you're done, use `items` method to print: `"Your username is <USERNAME>"`; `"Your email is <EMAIL"`; and `"Your password is <PASSWORD>"`
  43. for key, value in user.items():
  44. print("Your " + key + " is: " + value + ".")
  45.  
  46. # Return user
  47.  
  48.  
  49. # Otherwise if the password is too short, tell the user to try again
  50.  
  51.  
  52. # Get user information
  53. user_data = collect_user_information()
  54.  
  55. # Create user
  56. user = create_user(user_data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement