Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- import random
- import time
- import sys
- csvfile = open ("database.csv","r")
- readcsv = csv.reader(csvfile)
- def mainmenu():
- #print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
- print("(1) Login")
- print("(2) Register")
- print("(3) Credits")
- menuchoose = input("")
- #print ("\n")
- if menuchoose == "1":
- #print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
- login()
- if menuchoose == "2":
- #print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
- register()
- if menuchoose == "3":
- #print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
- credits()
- else:
- print("Incorrect input, please try again")
- mainmenu()
- def login():
- print("Login Section")
- csvfile = open ("database.csv","r")
- readcsv = csv.reader(csvfile)
- usercheck = input ("What is your username?\n")
- #print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
- passcheck = input ("What is your password?\n")
- for row in csv.reader(open("database.csv"), delimiter =','):
- if row[0] == usercheck and row[1] == passcheck:
- loggedin()
- else:
- #print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
- print("Incorrect details, please try again.")
- login()
- def register():
- print("Welcome to the register section.")
- csvfile = open ("database.csv","a")
- writer = csv.writer(csvfile)
- username = input ("Please pick a username\n")
- password = input ("Please pick a password\n")
- writer.writerow((username, password))
- print ("You are sucessfully registered!")
- csvfile.close()
- mainmenu()
- def credits():
- #print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
- print("CREDITS")
- print("")
- print("Luke Bissell - Helped when i got stuck")
- print("Ben Jordan - Helped with program layout")
- print("Miss Mamutse - Also helped when i got stuck")
- #print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
- print("Azeem Faisal")
- def loggedin():
- #print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
- print("You are sucessfully logged in.")
- print("A song will now be displayed, guess it right to earn points")
- songguess()
- def songguess():
- points = 0
- csvfile = open ("songs.csv", "r")
- readcsv = csv.reader(csvfile)
- for x in range(6):
- number = "1"
- for row in csv.reader(open("songs.csv"), delimiter =','):
- if row[0] == number:
- name=row[1]
- #print(name)
- print ("The first letter of the song is")
- print (name[0])
- #print ("\n")
- print ("The artist is")
- print (row[2])
- #print ("\n")
- guess1 = input("What is the song name?")
- #guess1 = guess1.title()
- print(guess1)
- #if guess1.title() == name:
- if guess1 == name:
- print("Correct! +1 point")
- points = points+1
- print ("You currently have", points,"points.")
- print("")
- else:
- print ("Incorrect song, try again")
- songguess()
- print(name)
- input()
- loop = 0
- if loop == 0:
- mainmenu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement