Coding for Kids · Lesson

Keeping Score

Count correct answers with a variable.

Lesson 3 of 413 steps

Keeping Score is a free Coding for Kids lesson on CoddyKit. This is lesson 3 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, and your progress syncs across the web and the CoddyKit app. The Coding for Kids course includes 4 lessons in total.

Keep the Score!

Hello game maker! 🎮🏅 Today we count how many answers are correct using a score!

A Score Variable

We make a box called score and start it at 0. 0️⃣

Every correct answer adds 1!

Starting the Score

Here we set the score to 0 to begin. 🏁

score = 0
print("Score: " + str(score))

Why str()?

Score is a number, but print likes text. 🔢➡️📝

str(score) turns the number into text so we can print it nicely!

Checking an Answer

We use if to check the answer. If it matches, add a point! ✅

answer = input("Sky color? ")
score = 0
if answer == "blue":
    score = score + 1
print("Score: " + str(score))

Two Equals Signs!

Notice == (two equals). 🤔

One = puts something in a box. Two == asks "are these the same?"

Adding a Point

score = score + 1 means "take the score and add 1". ➕

If the answer was right, the score goes up!

A Full Quiz Round

Ask a question, check it, update the score. All together! 🎯

score = 0
answer = input("What is 2 plus 2? ")
if answer == "4":
    score = score + 1
    print("Correct!")
print("Score: " + str(score))

Correct Adds a Point!

If you typed 4, the score went to 1 and it said "Correct!" 🎉

If not, the score stayed the same.

Counting Many Answers

For each question, we check and maybe add a point. 🏅

By the end, the score shows how many you got right!

score = 0
if "blue" == "blue":
    score = score + 1
if "meow" == "meow":
    score = score + 1
print("Score: " + str(score))

Score Master!

You learned to keep score with a variable, if, and ==. 🏅🏆

Next we show the final score!

Quick Check

Score quiz! 🏅

Scoring Pro!

Fantastic! 🎉 Your game keeps score now.

Last lesson: show the final score! 🎊

Free to start

Learn Python with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
35
Lessons
140

Frequently Asked Questions

Is the “Keeping Score” lesson free?

Yes — the full text of “Keeping Score” is free to read here on the web. 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. The Coding for Kids course includes 4 lessons in total.

What will I learn in “Keeping Score”?

Count correct answers with a variable. 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, so you can start here or from the beginning and move at your own pace. This is lesson 3 of 4.

How long does the “Keeping Score” 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. Planning the Quiz
  2. Asking Questions
  3. Keeping Score
  4. Showing the Final Score
← Back to Coding for Kids