Question: Using python, Create a login system that uses files to check if a username and password match. We must also create a user if they

Using python, Create a login system that uses files to check if a username and password match.
We must also create a user if they have not yet been created. There should be a limit of 5 attempts.
Store usernames in one file, and passwords in another
Create a login system that uses files to check if
a username and password match.
We must also create a user if they have not yet
been created. There should be a limit of 5 attempts.
Store usernames in one file, and passwords in another
"""
def loginSystem():
f1= open("U:\\usernames.txt","r+")
f2= open("U:\\passwords.txt","r+")
c1= f1.read()
c2= f2.read()
print("Welcome to the login system")
print("Enter your username and password when prompted")
print("What is your Username?")
user = input()
print()
print("What is your password?")
password = input()
if c1.find(user)!=-1 and c2.find(password)!=-1:
print("Successful Login")
else:
print("Login Unsuccessful")
Create a login system that uses files to check if
a username and password match.
We must also create a user if they have not yet
been created. There should be a limit of 5 attempts.
Store usernames in one file, and passwords in another
"""
def loginSystem():
f1= open("U:\\usernames.txt","r+")
f2= open("U:\\passwords.txt","r+")
c1= f1.read()
c2= f2.read()
print("Welcome to the login system")
print("Enter your username and password when prompted")
print("What is your Username?")
user = input()
print()
print("What is your password?")
password = input()
if c1.find(user)!=-1 and c2.find(password)!=-1:
print("Successful Login")
else:
print("Login Unsuccessful")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!