Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.17 KB | None | 0 0
  1. def main():
  2. pass
  3.  
  4. if __name__ == '__main__':
  5. main()
  6.  
  7. def main():
  8. pass
  9.  
  10. if __name__ == '__main__':
  11. main()
  12.  
  13.  
  14.  
  15. def doEasy(): ##This function will start operating when the easy difficulty is selected by the user
  16. global eq1
  17. global eq2
  18. global eq3
  19. global eq4
  20. easy1 = input("")
  21. easy1lower = easy1.lower()
  22. easy1answer = easy1lower[0:1]
  23. if easy1answer == "t":
  24. eq1 = "Correct"
  25. else:
  26. eq1 = "Incorrect"
  27. easy2 = input("")
  28. easy2lower = easy2.lower()
  29. easy2answer = easy2lower[0:1]
  30. if easy2answer == "n":
  31. eq2 = "Correct"
  32. else:
  33. eq2 = "Incorrect"
  34. easy3 = input("")
  35. easy3lower = easy3.lower()
  36. easy3answer = easy3lower[0:1]
  37. if easy3answer == "y":
  38. eq3 = "Correct"
  39. else:
  40. eq3 = "Incorrect"
  41. easy4 = input("")
  42. if easy4 == "49":
  43. eq4 = "Correct"
  44. else:
  45. eq4 = "Incorrect"
  46.  
  47. answerWriter()
  48.  
  49. def doMedium(): ##This function will start operating when the medium difficulty is selected by the user
  50. global mq1
  51. global mq2
  52. global mq3
  53. global mq4
  54. medium1ans = input("")
  55. if medium1ans == "5!":
  56. mq1 = "Correct"
  57. else:
  58. mq1 = "Incorrect"
  59. medium2ans = input("")
  60. if medium2ans == "1":
  61. mq2 = "Correct"
  62. else:
  63. mq2 = "Incorrect"
  64. medium3ans = input("")
  65. if medium3ans == "225":
  66. mq3 = "Correct"
  67. else:
  68. mq3 = "Incorrect"
  69. medium4ans = input("")
  70. if medium4ans == "13":
  71. mq4 = "Correct"
  72. else:
  73. mq4 = "Incorrect"
  74.  
  75. answerWriter()
  76. print("You chose: Easy")
  77. doEasy() ##Executes the easy function, beginning the quiz
  78. else:
  79. mediumHard() ##Executes the function that checks whether the difficulty is medium or hard
  80.  
  81. difcap = dif1.upper()
  82.  
  83. def mediumHard(): ##This is my GENIUS way around not being able to create a proper function that will quit if a number is inputted as a difficulty
  84. difcap = dif1.upper()
  85. fallback = input("I'm sorry, did you say " + difcap + "?")
  86. confirmation = fallback[0:1] #These two lines transform the input into a single lower case character for simpler input recognition
  87. confirmation1 = confirmation.lower() #These two lines transform the input into a single lower case character for simpler input recognition
  88. if difcap == "C" and confirmation1 == "y":
  89. print("You chose: Hard")
  90. doHard()
  91. elif difcap == "B" and confirmation1 == "y":
  92. print("You chose: Medium")
  93. doMedium()
  94. else:
  95. quit
  96.  
  97. def play(): ##This function asks the user if they would like to play or not, and may also give some information about the game if requested
  98. start = input("Would you like to begin? \nPlease simply enter Yes or No \nPlease enter help for more information.")
  99. main1 = start[0:1] #These two lines transform the input into a single lower case character for simpler input recognition
  100. maincase = main1.lower() #These two lines transform the input into a single lower case character for simpler input recognition
  101. if maincase == "h": ##This will give the user information about the quiz if they so choose to input anything beginning with 'H'
  102. helped = input("This game is a Quiz that will test your knowledge on a range of maths questions. \nYou can play on either Easy, Medium, or Hard modes.\nEach mode consists of FOUR questions.\nEasy is a 50/50 multiple choice. Medium is a 33/33/33. Hard is a 25/25/25/25.\n\nContinue?")
  103. helped1 = helped.lower()
  104. helped2 = helped1[0:1]
  105. if helped2 == "y":
  106. user() ##If the user chooses to continue after getting their information, this will start the quiz
  107. else:
  108. quit
  109. elif maincase == "y": ##This will begin the 'user' function if the user inputs anything beginning 'Y'
  110. user()
  111. elif maincase == "n": ##This will turn off the game if the user inputs anything beginning 'N'
  112. quit
  113.  
  114. def answerWriter():
  115. difcap = dif1.upper()
  116. writer = open((username)+ ".txt","w")
  117. writer.write("Difficulty chosen is " + difcap + "\n")
  118. if difcap == "A":
  119. writer.write("----------------------------------------------------\n")
  120. writer.write("Q1 "+ eq1 + "\n")
  121. writer.write("Q2 "+ eq2 + "\n")
  122. writer.write("Q3 "+ eq3 + "\n")
  123. writer.write("Q4 "+ eq4 + "\n")
  124. writer.write("----------------------------------------------------\n")
  125. elif difcap == "B":
  126. writer.write("----------------------------------------------------\n")
  127. writer.write("Q1 "+ mq1 + "\n")
  128. writer.write("Q2 "+ mq2 + "\n")
  129. writer.write("Q3 "+ mq3 + "\n")
  130. writer.write("Q4 "+ mq4 + "\n")
  131. writer.write("----------------------------------------------------\n")
  132. elif difcap == "C":
  133. writer.write("----------------------------------------------------\n")
  134. writer.write("Q1 "+ hq1 + "\n")
  135. writer.write("Q2 "+ hq2 + "\n")
  136. writer.write("Q3 "+ hq3 + "\n")
  137. writer.write("Q4 "+ hq4 + "\n")
  138. writer.write("----------------------------------------------------\n")
  139. writer.close()
  140.  
  141. play()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement