Guest User

Untitled

a guest
Dec 5th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. import sys
  2.  
  3. counter = 0
  4. check_failed = True
  5. while check_failed:
  6. print("Could player 1 enter their username and password")
  7. username1=input("Please enter your username ")
  8. password=input("Please enter your password ")
  9. with open("accountfile.txt","r") as username_finder:
  10. for line in username_finder:
  11. if ("username: " + username1 + " password: " + password) == line.strip():
  12. print("you are logged in")
  13. check_failed = False
  14. check_failed = True
  15. while check_failed:
  16. print("Could player 2 enter their username and password")
  17. username2=input("Please enter your username ")
  18. password=input("Please enter your password ")
  19. with open("accountfile.txt","r") as username_finder:
  20. for line in username_finder:
  21. if ("username: " + username2 + " password: " + password) == line.strip():
  22. print("you are logged in")
  23. check_failed = False
  24.  
  25. else:
  26. print("Sorry, this username or password does not exist please try again")
  27. counter = counter + 1
  28. if counter == 3:
  29. print("----------------------------------------------------")
  30. print("You have been locked out please restart to try again")
  31. sys.exit()
  32. else:
  33. print("Sorry, this username or password does not exist please try again")
  34. counter = counter + 1
  35. if counter == 3:
  36. print("----------------------------------------------------")
  37. print("You have been locked out please restart to try again")
  38. sys.exit()
Add Comment
Please, Sign In to add comment