Kids Coding

Find the Bug

Read the error. Print a value. Change one thing. Run again.

KidsIntermediateFind the Bug

Bugs are normal

A bug is code that does not do what you meant. Python often tells you the line. Read it. Change one thing. Run again.

A broken program

This one uses the wrong check. It always says miss even when the guess is right. That is a logic bug: it runs, but it is wrong.

Wrong on purpose

secret = 7
guess = 7
if guess = secret:
    print("Hit")
else:
    print("Miss")

That example uses = instead of ==. It should fail. Copy it, see the error, then fix it.

The fix

== not =

secret = 7
guess = 7
if guess == secret:
    print("Hit")
else:
    print("Miss")

Print to see

If the answer looks wrong, print the variables. Do not guess what is in the boxes. Look.

  • Read the error from the bottom.
  • Fix one cause.
  • Run again before you change something else.

Inspect

total = 2 + 2
print("total is", total)

Real life

A homework total that came out wrong.

You do not rewrite the whole page. You print the middle step and see where it broke.

Pocket money check

had = 20
spent = 7
left = had - spent
print("I think I have", left)
if left != 13:
    print("Check the sums again")
else:
    print("That matches")

Change one word. Run it. That is how this idea shows up outside the lesson.

Try it

Exercise 1: This line is wrong: print("Hi" + 3). Fix it so it prints Hi3.

Show solution
print("Hi" + str(3))

FAQ: Find the Bug

Common questions about this page.

What is StudyGrid Kids?

StudyGrid Kids is a free coding path for children: Basic, Intermediate, and Advanced. Lessons use Python in the browser. No account and no install.

Should I run find the bug examples locally for better learning?

Yes. Use the browser editor on StudyGrid for a quick check, then Download the example and run it on your computer. Local runs show real errors and the real toolchain, which is one of the fastest ways to learn find the bug in this Kids Coding Python lesson (Find the Bug).

Which kids level should we start with?

Start at Basic if the child has never written code. Choose Intermediate if they can print, use variables, and write a simple if. Choose Advanced if they already use loops and lists.

Do kids need an account or an app?

No. Kids pages are public. Code runs in the Try Python editor at /try. We do not ask children for a name or an email.

What language do kids learn?

Python, with a first HTML page in Intermediate and Advanced. After Advanced, the main Python tutorial is the next step.

Is the kids coding track free?

Yes. The Kids home, the three levels, and the Python editor on StudyGrid (studygrid.in) are free.