Activity — Think-Pair-Debug

Format for any lecture from 05 onward · 8 minutes · no slides needed.

  1. Think (2 min). Put a 6-line Python snippet with exactly one bug on the projector (reuse a case solution; change one character or swap two lines). Students individually list: what the code should do, what it actually does, and the line they suspect.
  2. Pair (3 min). Compare lists; agree on the single most probable bug and the smallest change that fixes it.
  3. Debrief (3 min). Two pairs report. The instructor runs the fix live and asks the closing question: what input would have caught this immediately? — connecting every bug to a test case.

Pitfalls. Pick bugs that are visible, not conceptual: inverted comparison, wrong initial value, off-by-one range, missing conversion. One bug only — two bugs turns it into a lecture.

Connection. This is the exact loop the course's debugging lectures train; reuse a real case's reference code so the snippet feels fair.