from random import * def Main() : Questions = [] # list of all the questions Answers = [] # list of all the answers setup(Questions, Answers) score = 0 numberAsked = 0 while len(Questions) > 0 : qnNum = randint(0, len(Questions)-1) correct = askQuestion(Questions[qnNum], Answers[qnNum]) numberAsked = numberAsked + 1 if correct == "quit" : break elif correct : score=score+1 del Questions[qnNum] del Answers[qnNum] print("Well done! You got ", score, " questions right out of ", numberAsked) #asks the user a question, and returns True or False depending on whether they answered correctly. # If the user answered with 'q', then it should return "quit" def askQuestion (question, correctAnswer): print(question) answer = input("True or False? (or quit)").lower() if answer == "quit" : return "quit" elif answer == correctAnswer.lower() : print("you got it right!") return True else : print("No, that's wrong. The correct answer is ", correctAnswer) return False # Sets up the lists of questions def setup(Questions, Answers) : Questions.append("Who is the youngest singer in One Direction?") Answers.append("Harry") Questions.append("Who is the oldest singer in One Direction?") Answers.append("Zack") Main()