#Title: Trivia Quiz #Author: Ari Ross #Date: 18/11/2026 #Version: 1 #Purpose: Ask the user some questions and tell them if they're right or wrong before giving them a score at the end questions = 0 score = 0 #Compares the user's guess with the answer def check_answer(question, answer, guess): if guess.strip().lower() == answer.lower(): return True else: return False #Asks a question and collects an answer, gives feedback def ask_trivia(question, answer): guess = input(f'What is the {question}? ') guess_correct = check_answer(question, answer, guess) if guess_correct == True: print(f"Congratulations! The {question} is indeed {answer}!") return 1 else: print(f"Sorry. The {question} is not {guess}.") return 0 score += ask_trivia('capital of Zimbabwe', 'Harare') questions += 1 score += ask_trivia("color of a zebra's nose", "black") questions += 1 score += ask_trivia("year Johnny nuked Arasaka Tower in the game Cyberpunk 2077","2023") questions +=1 score += ask_trivia("title of the sci-fi book set on the planet Arrakis","Dune") questions +=1 print(f"You correctly answered {score} out of {questions} questions!") print('') print("The program has ended")