Skip to content
CCC Python Course

Debugging

Stage
2
Module
M2.8
Lessons
1

In this module

  • Reproduce a bug on the smallest input that still shows it, before changing any code.
  • Bisect a program by printing intermediate state and by using assert, removing every print before submitting.
  • Recognize common bug families, including aliasing, mutating a list while iterating over it, integer versus float division, and a forgotten .strip().

Before this module

Lessons

  1. 1Debugging

Practice

Try these on the judges. Each link opens the problem on WMOJ or DMOJ.

  1. 2023 J3
    Special Event (opens on WMOJ in a new tab) WMOJ

    Given each person's availability across five days, find the day or days when the most people can attend.

  2. 2020 J3
    Art (opens on DMOJ in a new tab) DMOJ

    Given the coordinates of paint drops on a canvas, find the smallest rectangular frame that contains every drop without touching any of them.

    Why DMOJ: An earlier, DMOJ-era problem, included here for extra practice.