Advertisement
Guest User

for amelia ii.py

a guest
Jan 22nd, 2020
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. import csv
  2. import random
  3. import time
  4. import sys
  5.  
  6. csvfile = open ("database.csv","r")
  7. readcsv = csv.reader(csvfile)
  8.  
  9.  
  10. def mainmenu():
  11. #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")
  12. print("(1) Login")
  13. print("(2) Register")
  14. print("(3) Credits")
  15. menuchoose = input("")
  16. #print ("\n")
  17. if menuchoose == "1":
  18. #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")
  19. login()
  20. if menuchoose == "2":
  21. #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")
  22. register()
  23. if menuchoose == "3":
  24. #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")
  25. credits()
  26. else:
  27. print("Incorrect input, please try again")
  28. mainmenu()
  29.  
  30. def login():
  31. print("Login Section")
  32. csvfile = open ("database.csv","r")
  33. readcsv = csv.reader(csvfile)
  34. usercheck = input ("What is your username?\n")
  35. #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")
  36. passcheck = input ("What is your password?\n")
  37.  
  38. for row in csv.reader(open("database.csv"), delimiter =','):
  39. if row[0] == usercheck and row[1] == passcheck:
  40. loggedin()
  41. else:
  42. #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")
  43. print("Incorrect details, please try again.")
  44. login()
  45.  
  46.  
  47. def register():
  48. print("Welcome to the register section.")
  49. csvfile = open ("database.csv","a")
  50. writer = csv.writer(csvfile)
  51. username = input ("Please pick a username\n")
  52. password = input ("Please pick a password\n")
  53. writer.writerow((username, password))
  54. print ("You are sucessfully registered!")
  55. csvfile.close()
  56. mainmenu()
  57.  
  58.  
  59. def credits():
  60. #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")
  61. print("CREDITS")
  62. print("")
  63. print("Luke Bissell - Helped when i got stuck")
  64. print("Ben Jordan - Helped with program layout")
  65. print("Miss Mamutse - Also helped when i got stuck")
  66. #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")
  67. print("Azeem Faisal")
  68.  
  69. def loggedin():
  70. #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")
  71. print("You are sucessfully logged in.")
  72. print("A song will now be displayed, guess it right to earn points")
  73. songguess()
  74.  
  75.  
  76. def songguess():
  77. points = 0
  78. csvfile = open ("songs.csv", "r")
  79. readcsv = csv.reader(csvfile)
  80.  
  81. for x in range(6):
  82. number = "1"
  83. for row in csv.reader(open("songs.csv"), delimiter =','):
  84. if row[0] == number:
  85. name=row[1]
  86. #print(name)
  87. print ("The first letter of the song is")
  88. print (name[0])
  89. #print ("\n")
  90. print ("The artist is")
  91. print (row[2])
  92. #print ("\n")
  93. guess1 = input("What is the song name?")
  94. #guess1 = guess1.title()
  95. print(guess1)
  96. #if guess1.title() == name:
  97. if guess1 == name:
  98.  
  99. print("Correct! +1 point")
  100. points = points+1
  101. print ("You currently have", points,"points.")
  102. print("")
  103.  
  104. else:
  105. print ("Incorrect song, try again")
  106. songguess()
  107. print(name)
  108. input()
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. loop = 0
  123. if loop == 0:
  124. mainmenu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement