| Lesson Plan |
| Grade: |
Date: 03/03/2026 |
| Subject: Computer Science |
| Lesson Topic: Understand and use nested statements |
Learning Objective/s:
- Describe what a nested statement is and why it is used in programming.
- Explain the syntax and indentation (Python) or braces (Java) required for nested structures.
- Apply nested
if, while, and for statements to solve given problems.
- Identify common pitfalls such as missing indentation, infinite loops, and excessive nesting.
- Convert a nested logic block into an equivalent logical expression using
and/or.
|
Materials Needed:
- Projector and screen
- Whiteboard and markers
- Computer lab with Python IDE (e.g., IDLE) and Java IDE (e.g., Eclipse)
- Printed worksheets with practice questions
- Handout of flowchart diagram illustrating nested
if logic
- Sample code snippets (grading system, 2‑D array search)
|
Introduction:
Begin with a quick real‑world scenario (e.g., deciding whether to bring an umbrella based on weather forecasts) to highlight multi‑level decision making. Review students’ prior knowledge of simple if statements. Explain that by the end of the lesson they will be able to write, read, and debug nested control structures accurately.
|
Lesson Structure:
- Do‑now (5') – short quiz on basic
if statements; collect responses as an exit ticket.
- Mini‑lecture (10') – definition of nesting, why it’s useful, syntax rules for Python indentation and Java braces; show flowchart diagram.
- Guided coding demo (15') – walk through the grading system example in Python, emphasising indentation levels.
- Pair programming (15') – students implement the 2‑D array search in Java, using nested
for loops and break statements.
- Pitfalls discussion (10') – present common errors; learners identify and correct them in sample snippets.
- Independent practice (15') – worksheet with three practice questions (nested
if, nested loops, logical conversion); teacher circulates for support.
- Review & exit ticket (5') – each student writes one rule for correct nesting on a sticky note.
|
Conclusion:
Recap the key points: purpose of nesting, proper syntax, and how to avoid typical mistakes. Collect the exit tickets to gauge understanding. For homework, assign students to design a small program that uses at least two levels of nesting to solve a real‑world problem (e.g., menu‑driven calculator).
|