I Do: Introduce the recipe book analogy. Demonstrate `if`, `elif`, and `else` to create branching logic. Show how Python evaluates conditions.
We Do: Using our sandbox and GitHub Copilot, we’ll build a simple “access control” script. If a user’s role is “admin,” they get full access; if “editor,” limited access; otherwise, no access. Copilot will assist in suggesting the `if/elif/else` structure.
You Do: Create a script that takes a product’s price and applies a discount based on its value (e.g., >$100 gets 10% off, >$50 gets 5% off). Success criteria: Correct discount calculation and application.
Module 2: Building Blocks - Logic, Loops, and Functions
Now that you know how to store information, let’s teach Python how to make decisions, repeat tasks, and organize its thoughts. This is where your code starts to become truly smart and efficient.
Pedagogical Rationale (Module 2)
Technical Friction Point: Understanding control flow (when to do what) and the concept of code reusability (functions) can be challenging. Beginners often write repetitive code or struggle with the logical structure of conditional statements and loops.
Extended Analogy: Think of a detailed recipe book. Conditional statements (if/else) are like “If the sauce is too thick, add a splash of water, otherwise, continue simmering.” Loops (for/while) are “Stir the mixture until it thickens” or “Add one egg at a time, 6 times.” Functions are like “sub-recipes” or “pre-made components” (e.g., “Prepare the béchamel sauce”) that you can call upon whenever needed without rewriting all the steps.
Analogy Bridge: This analogy directly translates to algorithmic thinking. Conditionals guide the program’s decision-making path. Loops automate repetitive tasks, saving effort and reducing errors. Functions promote modularity, allowing complex problems to be broken down into manageable, reusable pieces, a cornerstone of efficient software design. This module introduces the first mandatory use of AI augmentation.





