Advertisement
Guest User

Untitled

a guest
Oct 8th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. #NEA Practise File - LOGGING IN AND REGISTRATION
  2.  
  3. print("To make an account to take part in the quiz, you must create a new account. Answer the questions below")
  4. print()
  5. name = input("Fore name:")
  6. print()
  7. age = int(input("Age:"))
  8. print()
  9. password = input("What would you like to set as your new password:")
  10. print()
  11. print()
  12. print("Your login details are in the file named 'username-and-password'")
  13. print()
  14.  
  15. #SENDING FILES TO A TXT FILE
  16.  
  17. with open("username-and-password","w") as f:
  18.     f.write("Your new username is:")
  19.     f.write("")
  20.     newname = name[:3]+str(age)
  21.     f.write(newname)
  22.     f.write("\n")
  23.     f.write("Your new password is:")
  24.     f.write("")
  25.     f.write(password)
  26.     f.write("\n")
  27.     f.write("Return to the program when you have finished")
  28.  
  29. #ENTERING LOGIN DETAILS
  30.  
  31. while True:
  32.     enteredUsername = input("Username:")
  33.     if enteredUsername == newname:
  34.         print("")
  35.         break
  36.     else:
  37.         print("Incorrect username - try again")
  38.  
  39.  
  40. while True:
  41.     enteredPassword = input("Password:")
  42.     if enteredPassword == password:
  43.         print("")
  44.         break
  45.     else:
  46.         print('You have entered incorrect password - try again')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement