Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- pass
- if __name__ == '__main__':
- main()
- def main():
- pass
- if __name__ == '__main__':
- main()
- def doEasy(): ##This function will start operating when the easy difficulty is selected by the user
- global eq1
- global eq2
- global eq3
- global eq4
- easy1 = input("")
- easy1lower = easy1.lower()
- easy1answer = easy1lower[0:1]
- if easy1answer == "t":
- eq1 = "Correct"
- else:
- eq1 = "Incorrect"
- easy2 = input("")
- easy2lower = easy2.lower()
- easy2answer = easy2lower[0:1]
- if easy2answer == "n":
- eq2 = "Correct"
- else:
- eq2 = "Incorrect"
- easy3 = input("")
- easy3lower = easy3.lower()
- easy3answer = easy3lower[0:1]
- if easy3answer == "y":
- eq3 = "Correct"
- else:
- eq3 = "Incorrect"
- easy4 = input("")
- if easy4 == "49":
- eq4 = "Correct"
- else:
- eq4 = "Incorrect"
- answerWriter()
- def doMedium(): ##This function will start operating when the medium difficulty is selected by the user
- global mq1
- global mq2
- global mq3
- global mq4
- medium1ans = input("")
- if medium1ans == "5!":
- mq1 = "Correct"
- else:
- mq1 = "Incorrect"
- medium2ans = input("")
- if medium2ans == "1":
- mq2 = "Correct"
- else:
- mq2 = "Incorrect"
- medium3ans = input("")
- if medium3ans == "225":
- mq3 = "Correct"
- else:
- mq3 = "Incorrect"
- medium4ans = input("")
- if medium4ans == "13":
- mq4 = "Correct"
- else:
- mq4 = "Incorrect"
- answerWriter()
- print("You chose: Easy")
- doEasy() ##Executes the easy function, beginning the quiz
- else:
- mediumHard() ##Executes the function that checks whether the difficulty is medium or hard
- difcap = dif1.upper()
- 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
- difcap = dif1.upper()
- fallback = input("I'm sorry, did you say " + difcap + "?")
- confirmation = fallback[0:1] #These two lines transform the input into a single lower case character for simpler input recognition
- confirmation1 = confirmation.lower() #These two lines transform the input into a single lower case character for simpler input recognition
- if difcap == "C" and confirmation1 == "y":
- print("You chose: Hard")
- doHard()
- elif difcap == "B" and confirmation1 == "y":
- print("You chose: Medium")
- doMedium()
- else:
- quit
- 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
- start = input("Would you like to begin? \nPlease simply enter Yes or No \nPlease enter help for more information.")
- main1 = start[0:1] #These two lines transform the input into a single lower case character for simpler input recognition
- maincase = main1.lower() #These two lines transform the input into a single lower case character for simpler input recognition
- if maincase == "h": ##This will give the user information about the quiz if they so choose to input anything beginning with 'H'
- 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?")
- helped1 = helped.lower()
- helped2 = helped1[0:1]
- if helped2 == "y":
- user() ##If the user chooses to continue after getting their information, this will start the quiz
- else:
- quit
- elif maincase == "y": ##This will begin the 'user' function if the user inputs anything beginning 'Y'
- user()
- elif maincase == "n": ##This will turn off the game if the user inputs anything beginning 'N'
- quit
- def answerWriter():
- difcap = dif1.upper()
- writer = open((username)+ ".txt","w")
- writer.write("Difficulty chosen is " + difcap + "\n")
- if difcap == "A":
- writer.write("----------------------------------------------------\n")
- writer.write("Q1 "+ eq1 + "\n")
- writer.write("Q2 "+ eq2 + "\n")
- writer.write("Q3 "+ eq3 + "\n")
- writer.write("Q4 "+ eq4 + "\n")
- writer.write("----------------------------------------------------\n")
- elif difcap == "B":
- writer.write("----------------------------------------------------\n")
- writer.write("Q1 "+ mq1 + "\n")
- writer.write("Q2 "+ mq2 + "\n")
- writer.write("Q3 "+ mq3 + "\n")
- writer.write("Q4 "+ mq4 + "\n")
- writer.write("----------------------------------------------------\n")
- elif difcap == "C":
- writer.write("----------------------------------------------------\n")
- writer.write("Q1 "+ hq1 + "\n")
- writer.write("Q2 "+ hq2 + "\n")
- writer.write("Q3 "+ hq3 + "\n")
- writer.write("Q4 "+ hq4 + "\n")
- writer.write("----------------------------------------------------\n")
- writer.close()
- play()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement