Oct-30-2017, 06:20 PM
Hello, I have been doing my coursework for computer science and my teacher advised that we go home and practice python in between hours in the coursework, I need help on Password and Username Verification as it requires the password and username to be stored in a .txt file outside of the program. I do not know how to check the .txt file against the logon information. This also must be able to work with more than one username and password. Thanks
I don't know if this violates the homework terms, if so please let me know.
I don't know if this violates the homework terms, if so please let me know.
Name = input("What is your first Name?\n") while True: try: Age = int(input("What is your age?\n")) Year = int(input("What is your year group?\n")) break except ValueError: print ("Error, Try again") NameFirst = Name[0] NameMain = Name[1:3] Name = NameFirst.upper()+NameMain.lower() #print (Name) Username = (Name + str(Age)) #print (Username) print ("This is your username for the quiz",Username) while True: Password = input("Please Enter a Password\n") PasswordCheck = input("Please Re Enter the password\n") if Password.lower() == PasswordCheck.lower(): break else: print ("Passwords Do Not Match!\nPlease Re Try.") f = open( 'Users.TXT', 'a' ) f.write(Username + '\n' + Password + '\n') f.close() #Logon file = open('Users.TXT', 'r') Data = file.read() file.close() #print (Data) while true LogonUsername = input("Please Enter Your Username\n")