Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NEA Practise File - LOGGING IN AND REGISTRATION
- print("To make an account to take part in the quiz, you must create a new account. Answer the questions below")
- print()
- name = input("Fore name:")
- print()
- age = int(input("Age:"))
- print()
- password = input("What would you like to set as your new password:")
- print()
- print()
- print("Your login details are in the file named 'username-and-password'")
- print()
- #SENDING FILES TO A TXT FILE
- with open("username-and-password","w") as f:
- f.write("Your new username is:")
- f.write("")
- newname = name[:3]+str(age)
- f.write(newname)
- f.write("\n")
- f.write("Your new password is:")
- f.write("")
- f.write(password)
- f.write("\n")
- f.write("Return to the program when you have finished")
- #ENTERING LOGIN DETAILS
- while True:
- enteredUsername = input("Username:")
- if enteredUsername == newname:
- print("")
- break
- else:
- print("Incorrect username - try again")
- while True:
- enteredPassword = input("Password:")
- if enteredPassword == password:
- print("")
- break
- else:
- print('You have entered incorrect password - try again')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement