Keeping Score
Count correct answers.
Keeping Score is a free Coding for Kids lesson on CoddyKit — 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, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Keep the Score! 🏆🔢
A good quiz keeps SCORE! 🏆 Every time you get one right, your score goes up!
Let's learn how to count correct answers. 🎯
score = 0
print('Your score starts at', score)A Score Box Starts at Zero 📦
Before the quiz starts, the score is 0. Nobody has answered yet! 🥚
We make a box: score = 0. This box will grow as you get answers right!
score = 0
print('Score:', score)Adding 1 to the Score ➕
When you get one right, add 1 to the score! 🎉
score = score + 1 means 'take the score and make it one bigger.' Magic counting! 🪄
score = 0
score = score + 1
print('Score is now', score)A Shortcut: += ⚡
Coders are lazy (in a good way!) 😄 Instead of score = score + 1, we can write score += 1.
It does the exact same thing, just shorter! ⚡
score = 0
score += 1
score += 1
print('Score:', score)Score Up Only If Correct ✅
We only add to the score when the answer is RIGHT! 🎯
We put score += 1 inside the if for correct answers.
score = 0
guess = 12
correct = 12
if guess == correct:
score += 1
print('Correct!')
else:
print('Wrong!')
print('Score:', score)Score Over Many Questions 🔁
Let's use a loop for 3 questions and count correct ones! 🔁
The score box stays OUTSIDE the loop so it remembers across all questions.
score = 0
guesses = [12, 7, 20]
answers = [12, 8, 20]
for i in range(3):
if guesses[i] == answers[i]:
score += 1
print('You got', score, 'correct!')A Random Quiz With Score 🎲🏆
Let's combine random questions AND scoring! 🤩
For each question we make numbers, check the guess, and add to score if correct.
import random
score = 0
for q in range(3):
a = random.randint(1, 10)
b = random.randint(1, 10)
correct = a + b
guess = correct
if guess == correct:
score += 1
print('Final score:', score)Cheer the Player On! 🎉
Let's say something fun each time they score! 🥳
Inside the if, we print a cheer AND add to the score.
score = 0
correct = 15
guess = 15
if guess == correct:
score += 1
print('Yes! Plus one point! 🌟')
print('Score:', score)Count Wrong Answers Too ❌
We can also count the MISSES! 🙈
Make a second box wrong = 0 and add to it in the else part.
score = 0
wrong = 0
guesses = [12, 5]
answers = [12, 9]
for i in range(2):
if guesses[i] == answers[i]:
score += 1
else:
wrong += 1
print('Right:', score, 'Wrong:', wrong)Show Score After Each Question 📊
Let's print the running score after every question, so the player always knows! 📊
We just print the score inside the loop.
score = 0
for q in range(3):
score += 1
print('Question', q + 1, '- Score so far:', score)Build Your Own Scorekeeper! 🏆🎨
Your turn! Change the guesses and answers and watch the score change. 🤩
Try making all of them match for a perfect score! 💯
score = 0
guesses = [6, 8, 10]
answers = [6, 8, 12]
for i in range(3):
if guesses[i] == answers[i]:
score += 1
print('Your score:', score, 'out of 3')Quick Check ✅
Scorekeeping brain teaser! 🧠🏆
Scorekeeper Done! 🏆🎉
Awesome! Your quiz keeps score now! You learned:
- Start the score at
0📦 score += 1adds a point ⚡- Only add inside the correct
if✅ - The score box lives OUTSIDE the loop to remember 🔁
Next: show the final score and how they did! 📊
Frequently asked questions
Is the “Keeping Score” lesson free?
Yes — the full text of “Keeping Score” 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 “Keeping Score”?
Count correct answers. 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 3 of 4, so you can start here or from the beginning and move at your own pace.
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
- Making Questions
- Checking Answers
- Keeping Score
- Final Score