Import Random Research Paper

Satisfactory Essays
import random #Here are the questions for the game #Each question has a different symbol def questions(): start = yes_no("Hi there! Were going to play a maths game! Would you like to start?(y/n)?: ") if start == "y": print("Good luck!") else: input("\n\nPress the enter key to quit.") return response choice = random.choice("-+x") finish = False questionNo = 0 correctAnswers = 0 #generates the questions in the correct order #generates a random number between 1-20 for each number #asks for users answer while not finish: choice = random.choice("-+x") if questionNo < 10 | questionNo >= 0: firstNumber = random.randrange(1,20) secondNumber = random.randrange(1,20)…show more content…
Correct answer! Here comes the next one..") correctAnswers = correctAnswers + 1 else: print("Unlucky, that is the wrong answer!") else: finish = True else: input("You scored " + str(correctAnswers) + "/10.") #Display game instructions def instructions(): print( """ The instructions are as follows: There are 10 guestions, so answer as many as you can! The questions will be a mixture of +, x and -! Once the questions are over, we will add up your score to see how well you did! Good luck! \n """ ) #Asks a yes or no question to start the game def yes_no(question): response = None while response not in ("y", "Y", "n", "N"): response = input(question).lower() return response #Highscores def highscores(): scores = scores[:5] choice = None while choice != "0": print( """ High Scores Menu 0 - Back to start 1 - Show highscores 2 - Add a
Get Access