Skip to content
Learn Python with BNHR

Debugging drill D1 · Beginner

Debugging drill: values, records and loops

The first debugging drill of Python Essentials, after module 4: eight functions from the barangay's work, each with one everyday mistake, to predict, trace, fix and explain.

Extra D1Level Beginner
On this page
  1. Overview
  2. Its notebooks
  3. Certification and support

Eight functions from the barangay’s work, each with one mistake in it, the kind everyone makes: a number that is still text, a record without the key you asked for, a list changed behind the caller’s back, a total that starts again inside its loop, conditions in the wrong order, a loop that answers after one household, a range that stops one short, and a condition that leaves out its edge. Each check starts red: that is the point.

For each one you predict what the function gives, run it, trace the line that makes the difference (reading an error from the bottom up, printing inside a loop, following a value through the conditions by hand), fix it, and say in one sentence what the mistake was. Only two of the eight stop with an error; the others give a wrong answer quietly, and the last gives the right one on the barangay’s own records, so that only its check finds it. The companion has each fix and why it works.

The notebooks are in your course folder; here you can read them without running anything.

Saved in this browser only

Certification and support

We offer additional resources, certificates, ongoing support, and other perks to those who join our instructor-led training.

Join an upcoming training to take this as an instructor-led course, or contact us to arrange one for your team or organization.

Something new

Identify results
LayerExplore a debugging drill
Debugging drill D1Debugging drill: five broken functions
AboutThe debugging drill of Python for Data Management, after module 3: five broken functions, each with one everyday mistake, to read, find, fix and explain in twenty minutes.
CoursePython for Data Management, free