Computer Science10th Grade55 minutes

High School Python Debugging Lesson Plan

Students learn systematic debugging strategies by analyzing common Python errors, fixing buggy code in pairs, and presenting their debugging process to the class.

Learning Objectives

  • Identify and classify syntax, runtime, and logic errors in Python code.
  • Apply a systematic debugging strategy (read, run, trace, fix).
  • Explain their debugging process clearly to a peer.

Warm-Up: Error Gallery

7 min
  • Display 3 short Python snippets, each with a different error type (syntax, runtime, logic).
  • Students identify the error type and predict the error message for each.
  • Quick class review: 'What clues helped you identify each type?'

Mini-Lesson: Debugging Strategy

10 min
  • Introduce the 4-step strategy: Read the error message, Run with print statements, Trace the logic, Fix and re-test.
  • Live demo: debug a function with a logic error using the 4-step process.
  • Post the strategy poster for reference.

Pair Debugging: Bug Hunt

20 min
  • Pairs receive 4 buggy Python programs of increasing difficulty.
  • For each: identify the error type, apply the 4-step strategy, fix the code, document what they changed and why.
  • Teacher circulates and asks: 'What step are you on? What did the error message tell you?'

Code Review Presentations

12 min
  • 3–4 pairs present their hardest bug fix to the class.
  • Explain: what was the bug, what strategy helped, what they changed.
  • Class asks clarifying questions.

Closure

6 min
  • Exit ticket: 'Given this error message, what would be your first two debugging steps?'
  • Collect. Preview: 'Tomorrow we tackle debugging in a larger project.'

Differentiation Notes

  • Scaffold: Bug hint cards that narrow down the error location.
  • Extension: Debug a more complex program with multiple interacting bugs.
  • ELL support: Error type reference card with definitions and example messages.

Assessment

  • Student product: 4 fixed programs with documentation of changes.
  • Criteria: Correct fix for each bug, accurate error classification, clear documentation.
  • Success indicator: 80% of pairs correctly fix at least 3 of 4 bugs.

Teacher Tips

  • Pre-test all buggy programs yourself to make sure the bugs are solvable and the error messages are informative.
  • Pair a confident coder with a developing one — debugging is where collaboration really shines.
  • If pairs finish early, have them create a bug for another pair to find and fix.

Questions about this lesson

Related guides

Customize this lesson plan

Use LessonCraft to create your own version of this computer science plan with your timing, standards, and differentiation needs.

Customize this plan