Skip to content
Learn Python with BNHR

Debugging drill D2 · Beginner

Debugging drill: a report that goes wrong

The second debugging drill of Python Essentials, after module 6: a short script that reports on the barangay's files, stops with an error, then gives four wrong figures out of five, to trace and fix one function at a time.

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

The barangay office asked for five figures from its files, and someone wrote a short script to give them. It stops with an error, and once that is fixed it gives four wrong figures out of five, without a word. The office worked the figures out by hand, so you know what the script should say.

Each figure comes from a function with one mistake from modules 2 to 6: a column name the file doesn’t have, numbers compared as text, a function using a name it was not given, an except that hides a misspelt name, and a yes-or-no column where "no" counts as true. As in the first drill, you predict, trace, fix and explain each one, and each check starts red. On the way, a short example shows why every file in the course is opened with encoding="utf-8".

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: a table that lies
AboutThe first debugging drill of Arrays & DataFrames, after module 3: six bugs in reading and selecting the farm survey, to predict, trace, fix and explain.
CourseArrays & DataFrames, free