Lesson 4: Debugging: finding what is wrong, step by step
17 min read·14 Oct 2026
Module 8 · Lesson 4 · About 50 minutes · Needs: Module 8 Lesson 1 (tracebacks, try and except), Module 6 Lesson 3 (assert), Module 3 Lesson 3 (repr()and the=specifier)
The situation
Amira wants Tom's old notebook read into the program, so the September loans are not lost. You write a first try at reading it, run it over the twelve lines, and it crashes on the fifth. Tom says there are "a few mistakes" in his typing. Nobody knows how many, or where.
Changing code at random is slow and makes new bugs. This lesson gives you a method and five tools, and finds every fault in the notebook with them.