0Pricing
Coding for Kids · Lesson

Checking Answers

Compare to the right answer.

Checking Answers is a free Coding for Kids lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Coding for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Check the Answers! ✅❌

Now the fun part: checking if the player got it RIGHT! 🎯

The computer compares the player's answer to the correct answer. Let's learn how! 🧠

print('Is your answer correct? Let us find out!')

Comparing Two Numbers 🤔

We use == to ask 'are these equal?' (Two equal signs!) 🟰

It gives back True if they match, or False if they don't.

print(5 == 5)
print(5 == 8)

The Magic Word: if 🪄

if lets the computer DECIDE what to do! 🪄

'IF the answer is correct, say Great job!' The indented line only runs when it's true.

answer = 12
if answer == 12:
    print('Correct! Great job!')

What if It's Wrong? ❌

We add else for the WRONG case! 🙅

'IF correct say yes, ELSE say try again.' The computer picks one or the other.

answer = 10
if answer == 12:
    print('Correct!')
else:
    print('Oops, try again!')

Check a Math Answer ➕✅

Let's check a real math question! The correct answer is 7 + 5.

We compare the player's guess to the correct answer with if and else.

correct = 7 + 5
guess = 12
if guess == correct:
    print('Yes! That is right!')
else:
    print('Not quite. The answer was', correct)

Asking the Player 🗣️

In a real game, the player TYPES their answer. We use input() for that! ⌨️

But input gives us text, not a number. We turn it into a number with int()!

guess = int('12')
print('You typed the number', guess)
print(guess + 1)

Why int() Matters 🔢

Text and numbers are different! '12' with quotes is TEXT. 12 is a NUMBER. 🤔

int() turns text into a number so we can compare it to the answer correctly!

text_answer = '15'
number_answer = int(text_answer)
print(number_answer == 15)

Full Question Check 🎯

Let's put it together: a question, the correct answer, and a check! 🎉

We pretend the player guessed 14. Is it right?

import random

a = random.randint(1, 10)
b = random.randint(1, 10)
correct = a + b
print('What is', a, '+', b, '?')
guess = correct
if guess == correct:
    print('Correct! 🎉')
else:
    print('Wrong! It was', correct)

Give a Helpful Hint 💡

When the player is wrong, let's be kind and show the right answer! 💡

We print the correct answer in the else part so they can learn.

correct = 20
guess = 18
if guess == correct:
    print('Perfect!')
else:
    print('Close! The right answer was', correct)

Bigger or Smaller? ⬆️⬇️

We can give EVEN better hints! Use > (bigger) and < (smaller).

'Your guess is too big!' or 'too small!' helps the player guess again. 🎯

correct = 15
guess = 20
if guess > correct:
    print('Too big! Try smaller.')
else:
    print('Too small! Try bigger.')

Make Your Own Checker! ✅🎨

Your turn! Change the guess number and see if it matches. 🤩

Try making guess equal to correct, then different. Watch the message change!

correct = 9 * 3
guess = 27
if guess == correct:
    print('You got it! 🎉')
else:
    print('Almost! The answer was', correct)

Quick Check ✅

Answer-checking brain teaser! 🧠✅

Answer Checker Done! ✅🎉

Awesome! Your quiz can check answers now! You learned:

  • == checks if two values are equal 🟰
  • if and else let the computer decide 🪄
  • int() turns text into a number 🔢
  • > and < give bigger/smaller hints ⬆️⬇️

Next: keep SCORE of correct answers! 🏆

Frequently asked questions

Is the “Checking Answers” lesson free?

Yes — the full text of “Checking Answers” is free to read here on the web, and the Coding for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Coding for Kids course, upgrade to CoddyKit PRO.

What will I learn in “Checking Answers”?

Compare to the right answer. You practise Coding for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Coding for Kids?

No prior experience is required. Coding for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Checking Answers” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Coding for Kids lesson?

Yes. Every Coding for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Making Questions
  2. Checking Answers
  3. Keeping Score
  4. Final Score
← Back to Coding for Kids