Debug the code

Every one of these has a bug. Can the class spot it and say how to fix it?

It should:

    Class Dashboard

    How to use it

    1. Choose Everyday, Blocks or Python in Settings. You can pick more than one.
    2. Read the goal together: what should this code do?
    3. Pupils discuss with a partner, then someone taps the line they think is wrong.
    4. Ask them to explain the fix before you show it.

    Good questions to ask

    • What would actually happen if a computer followed these steps exactly?
    • Is it a syntax error (the computer can't run it) or a logic error (it runs, but does the wrong thing)?
    • How could we test it to find the bug faster?

    Questions teachers ask

    What age is it for?

    Everyday steps suit Key Stage 1 and lower Key Stage 2. Block code is like Scratch, for Key Stage 2. Python puzzles are for Key Stage 3 and anyone starting text-based coding.

    How do pupils answer?

    Tap or click the line with the bug. If it is right, the line turns green and the fix and explanation appear. If not, it shakes and you can try again. You can also press a line number on the keyboard.

    Can I add my own puzzles?

    Yes. Open Make a puzzle in the settings, type the lines, choose which line has the bug and write the fix. Your puzzles are saved in this browser only and appear in My puzzles.

    What kinds of bug are there?

    Wrong order (sequence), wrong numbers in loops, conditions that check the wrong thing (selection), typos and missing punctuation (syntax errors), and code that runs but gives the wrong answer (logic errors).