Lesson Plan

Lesson Plan
Grade: Date: 17/01/2026
Subject: Computer Science
Lesson Topic: Understand local and global variable scope
Learning Objective/s:
  • Describe the difference between global and local variable scope.
  • Explain how scope influences a variable’s lifetime and visibility.
  • Apply the correct use of the global keyword in Python to modify a global variable.
  • Identify common scope‑related errors such as shadowing and forgetting the global statement.
  • Evaluate best‑practice guidelines for variable declaration in IGCSE programming tasks.
Materials Needed:
  • Projector or interactive whiteboard
  • Laptop with Python IDE (IDLE, VS Code, etc.)
  • Printed worksheet with code snippets and a revision checklist
  • Sample code file demonstrating global and local variables
  • Whiteboard and markers
  • Homework handout with practice questions
Introduction:

Begin with a quick poll: “Where have you seen variables that affect the whole program?” Connect this to prior knowledge of variables from earlier lessons. Explain that today’s success criteria are to recognise scope, use the global keyword correctly, and avoid common pitfalls.

Lesson Structure:
  1. Do‑now (5'): Students complete the “Quick Revision Checklist” on their handout.
  2. Mini‑lecture with slides (10'): Define scope, compare global vs local, show the comparison table.
  3. Guided coding demo (15'): Live walk‑through of the provided Python example, highlighting the global statement.
  4. Pair programming activity (15'): Students modify the example to add a second function, practising local variables and avoiding shadowing.
  5. Class discussion of common pitfalls (10'): Share findings, correct misconceptions about shadowing and missing global.
  6. Exit ticket (5'): Write one rule for using global variables and one tip for choosing local variables.
Conclusion:

Recap the key differences between global and local scope and why proper use improves readability and debugging. Collect exit tickets to gauge understanding, and assign a short homework task: rewrite a given program using only local variables where possible.