The dragon explains
The Debugging Procedure
The dragon: You've fixed crashes, named exception types, and found a bug with no error message at all. Here's the procedure tying it together — five steps, every time.
The dragon: 1. Read the error — or notice there isn't one. 2. Say what you EXPECTED. 3. Say what ACTUALLY happened. 4. Change ONE thing. 5. Run again.
The dragon: Step 4 is the one everyone skips under pressure — changing three things at once because you're not sure which one matters.
The dragon: The problem: if you change three things and it works, you don't actually know WHICH change fixed it. If it still doesn't work, you don't know which change made it worse.
The dragon: One change, one run, one clear answer each time. Slower per step, but genuinely faster overall — because you stop guessing.
The dragon: This works whether there's a traceback (segments 1-2) or dead silence (segment 3) — expected vs. actual is the constant, whatever form the mismatch takes.
Quick check
Check your understanding
Say your answer out loud before reading the marked one. Every wrong option is a mistake real beginners make.
Question 1 of 2
A child changes three lines at once, reruns, and the bug is gone. What's the problem with this approach?
- They don't actually know WHICH of the three changes fixed itCorrect
- There's no problem — the bug is fixed, that's what matters
Why: They don't know which change actually mattered — maybe only one of the three fixed anything, and the other two were unrelated or even risky. Changing ONE thing at a time is slower per step but means every result actually teaches you something.
Question 2 of 2
Which step of the procedure applies even when there's NO error message at all?
- Say what you expected vs. what actually happened — that comparison works with or without a tracebackCorrect
- None of them — the procedure only works when there's a real error to read
Why: Expected vs. actual — that's the core of the whole procedure, and it works identically whether Python gave you a traceback (segments 1-2) or stayed completely silent while doing the wrong thing (segment 3). The traceback is a HELPFUL shortcut when it exists, not the only way in.
In the game
What you'll practice
Three levels in the game: one guided first try with the shape of the answer already there, then two to solve on your own.
- 1
GuidedYour first try
This code crashes with a KeyError. Before fixing anything: read the error, then fix stats to use a key that actually exists — level, not lvl.
- +2
PracticeTwo more, on your own
This lesson is part of PRO.
PRO is a one-time $49.99 purchase, no subscription, and unlocks this whole topic along with everything else. Topics 1–3 are free, start to finish.
Unlock this lesson with PROStuck three times? The game offers the answer — unasked.