Check If Correct

Use an if statement to print "Correct!" when the player's answer is right

💻

Writing code and entering commands is only available on desktop. Open this page on a larger screen to complete this chapter.

The quiz currently ends with print(f"Correct: {is_correct}"). When the player gets it right, the output is Correct: True — not exactly satisfying feedback.

You already have is_correct as a Boolean. Now you need to check it and print a real message.

The if statement in practice

if condition:
    # runs when condition is True

For PyQuiz, the condition is is_correct. When it is True, print "Correct!":

if is_correct:
    print("Correct!")

The indented print only runs when the player answered correctly. When they are wrong, nothing prints yet — you will handle that in the next chapter.

Where this goes

Replace the print(f"Correct: {is_correct}") line with the if block. It goes in the same position, right after print(f"You answered: {answer}").

Instructions

Replace the raw Boolean output with real feedback.

  1. Remove print(f"Correct: {is_correct}") and replace it with an if statement: if is_correct is True, call print("Correct!") — this runs the feedback message only when the player got it right, instead of always printing the raw True/False value.