If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Challenge: Flashcards

Instructions

Step 1

Print the correct answer

Erick created a flashcard program to help him review Python concepts. As he’s studying, he realizes that when he gets a question wrong, it would help if the program showed the correct answer. That way, he can learn from his mistakes!

  • For each question, if the user enters an incorrect answer, print the correct answer.

For example, if the user answers 4 for the second question, the program might print: The correct answer is: 2. Careful - if the user enters the correct answer, the program should still print: You got it!, but it should not print: The correct answer is: 2.

Code editor

Code files

Output