Advertisement
Guest User

Untitled

a guest
Feb 10th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. import csv
  2. def MainMenu():
  3. no = int(input("""
  4. 1. Sign up
  5. 2. Login
  6. 3. Leaderboards
  7. 4. Exit """))
  8. if no == 1:
  9. SignUp()
  10. elif no == 2:
  11. Login1()
  12. elif no == 3:
  13. Leaderboards()
  14. elif no == 4:
  15. Exit()
  16.  
  17.  
  18. def SignUp():
  19. username = input("please enter your username")
  20. password = input("please enter your password")
  21. csvfile = open("accounts.csv", "a+")
  22. Line = username + "," + password + "\n"
  23. csvfile.write(Line)
  24. csvfile.close()
  25. print("\nAccount Created!")
  26.  
  27. def Login1():
  28. q_username = input("Enter your username")
  29. q_password = input("Enter your password")
  30. with open("accounts.csv") as csvfile:
  31. readCSV = csv.reader(csvfile, delimiter=',')
  32. for row in readCSV:
  33. if row[0]==q_username and row[1]==q_password:
  34. print("Logged in")
  35. break
  36. else:
  37. print("Login Failed, try again")
  38. Login1()
  39.  
  40. def Login2():
  41. print("q")
  42.  
  43. MainMenu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement