Python Quest

Track 9 · Lesson 10 of 11

A debugging strategy

Find bugs systematically: reproduce, isolate, hypothesise and test, inspect state with print(), and record what a program does with the logging module.

About 45 minIntermediate4 exercises

You will be able to

  • Follow a repeatable process: reproduce, isolate, hypothesise, test, fix, confirm
  • Use print() with f"{name=}" to inspect variable state at the right moment
  • Narrow a bug down by testing each step of a pipeline separately (binary search through code)
  • Log messages at DEBUG, INFO, WARNING and ERROR levels with the logging module, including tracebacks with logger.exception

Included with a Formula Quest membership

It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.