I'm a new poster here, and a complete and total beginner at programming. I decided to start with Python since I'd read that it was an easy one to learn for beginners. I'm using some online tutorials, and one of the exercises was to work on some code for a small quiz program. However, I keep getting a strange syntax error, and I can't get the reason. I was hoping that someone experienced could take a look and tell me what I'm missing? Thanks a lot.
def main_menu(): print("1. Print the menu") print("2. Take the test") print("3. Quit the program:") def get_questions(): return[["What color is the daytime sky on a clear day? ", "blue"], ["What is the answer to life, the universe and everything? ", "42"], ["What is a three letter word for mouse trap? ", "cat"], ["What noise does a truly advanced machine make?", "ping"]] def check_question(question_and_answer): question = question_and_answer answer = question_and_answer given_answer = input(question) if answer == given_answer: print("Correct") return True else: print("Incorrect, correct was:", answer) return False def run_test(questions): if len(questions) == 0: print("No questions were given.") return index = 0 right = 0 while index < len(questions): if check_question(questions[index]): right = right + 1 index = index + 1 print("You got", right " 100 / len(questions),\ % right out of", len(questions)) choice = 1 while choice != 3: if choice == 1: #Here's where I get a syntax error, in a small space right before the if. main_menu() elif choice == 2: run_test(questions) print() choice = int(input("Choose an option: ")) print("Goodbye")