One short program on the board, and a promise: it contains exactly
one bug. Your job is to find it by reading β no running, no random
guessing. Programs fail in a handful of predictable ways, and
learning to spot them cold is what turns a panicked debugging session
into the calm routine of Debugging Step by Step.
How to run it
Read the whole program before judging any line β bugs love the
line you skimmed.
Decide: will it crash, or run and quietly do the wrong thing?
Name the line, name the fault, predict the exact error message.
Only then run it β and read the real message, bottom line first.
Try one (click to expand)
age = input("How old are you? ")if age >= 13: print("Welcome to the teen zone")
It looks fine, and it crashes on line 2. input always hands back
text, and Python refuses to compare text with the number 13.
The fix is one word β but naming the fault is todayβs whole job.
One variation
Show only a traceback β no program at all β and work backwards: what
kind of line must have produced this message?
Error messages are not insults
They are the most honest writing you will read all day β what went
wrong, and where. Read them calmly, bottom line first, every time.
Curriculum connection
C2.6
interpret program errors and implement strategies to resolve them