Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- counter = 0
- check_failed = True
- while check_failed:
- print("Could player 1 enter their username and password")
- username1=input("Please enter your username ")
- password=input("Please enter your password ")
- with open("accountfile.txt","r") as username_finder:
- for line in username_finder:
- if ("username: " + username1 + " password: " + password) == line.strip():
- print("you are logged in")
- check_failed = False
- check_failed = True
- while check_failed:
- print("Could player 2 enter their username and password")
- username2=input("Please enter your username ")
- password=input("Please enter your password ")
- with open("accountfile.txt","r") as username_finder:
- for line in username_finder:
- if ("username: " + username2 + " password: " + password) == line.strip():
- print("you are logged in")
- check_failed = False
- else:
- print("Sorry, this username or password does not exist please try again")
- counter = counter + 1
- if counter == 3:
- print("----------------------------------------------------")
- print("You have been locked out please restart to try again")
- sys.exit()
- else:
- print("Sorry, this username or password does not exist please try again")
- counter = counter + 1
- if counter == 3:
- print("----------------------------------------------------")
- print("You have been locked out please restart to try again")
- sys.exit()
Add Comment
Please, Sign In to add comment