Python Forum
Password and Username Verification
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Password and Username Verification
#1
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.

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")
Reply


Messages In This Thread
Password and Username Verification - by AlwaysNew - Oct-30-2017, 06:20 PM
RE: Password and Username Verification - by wavic - Nov-12-2017, 11:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  function-decorator , which is checking an access according to USERNAME Liki 6 2,301 Feb-17-2024, 03:36 AM
Last Post: deanhystad
  python code tp determin a userName and print message jackAmin 4 3,091 Nov-20-2022, 12:03 AM
Last Post: rob101
  Help! Chatting App - Changing the "IP & Port" into Username Rowan99 0 2,022 Dec-20-2021, 07:02 AM
Last Post: Rowan99
  Username and password Steve2017 13 12,648 Sep-03-2017, 09:17 PM
Last Post: Steve2017

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020