Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- def MainMenu():
- no = int(input("""
- 1. Sign up
- 2. Login
- 3. Leaderboards
- 4. Exit """))
- if no == 1:
- SignUp()
- elif no == 2:
- Login1()
- elif no == 3:
- Leaderboards()
- elif no == 4:
- Exit()
- def SignUp():
- username = input("please enter your username")
- password = input("please enter your password")
- csvfile = open("accounts.csv", "a+")
- Line = username + "," + password + "\n"
- csvfile.write(Line)
- csvfile.close()
- print("\nAccount Created!")
- def Login1():
- q_username = input("Enter your username")
- q_password = input("Enter your password")
- with open("accounts.csv") as csvfile:
- readCSV = csv.reader(csvfile, delimiter=',')
- for row in readCSV:
- if row[0]==q_username and row[1]==q_password:
- print("Logged in")
- break
- else:
- print("Login Failed, try again")
- Login1()
- def Login2():
- print("q")
- MainMenu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement