# Conditionals > Ninth graders use if / elif / else to make a program choose a path. Python checks the conditions top to bottom and runs the FIRST one that is true. They… **Computer Science** | **Grade 9** *A free lesson plan from K12 Academics. Source page: https://lessonplans.k12academics.com/k12-lesson-g9-cs-conditionals.html* Ninth graders use if / elif / else to make a program choose a path. Python checks the conditions top to bottom and runs the FIRST one that is true. They order a grade-checker, then build a branching program of their own. **Copy link** works with Canvas, Schoology, Moodle and any other LMS — paste it in as a resource or assignment. ## Everything you need before the bell rings ### Learning Objectives Students will be able to… - Write **if / elif / else**. - See conditions checked **top to bottom**. - Know only the **first true** branch runs. - Build a decision program. How does a program choose between several paths? ## Order the Grade-Checker Project this and have students put the if / elif / else branches in the order Python checks them. ## 55 minutes, five moves Tap any phase to open the teacher moves and student actions. ### Hook — Which Path? How could a program turn a score into a letter grade? #### 👩‍🏫 Teacher Moves - Show a score and ask the grade. - Ask how to choose. - Set the goal. #### 🎒 Student Actions - Think. - Guess. - Get ready. ### Use — Conditionals Students use conditionals. #### 👩‍🏫 Teacher Moves - Send students to Order the Grade-Checker. - Order the branches. - Note top-to-bottom, first-true-wins. #### 🎒 Student Actions - Order. - Say. - Note it. ### Modify — Reorder & Test Students modify. #### 👩‍🏫 Teacher Moves - Swap two branch thresholds. - Predict a new result. - Test with a score. #### 🎒 Student Actions - Swap. - Predict. - Test. ### Create — Build a Brancher Students create. #### 👩‍🏫 Teacher Moves - Write an if/elif/else (e.g. ticket price by age). - Add an else for all other cases. - Test 3 inputs. #### 🎒 Student Actions - Write. - Add. - Test. ### Reflect — Reflect Students close. #### 👩‍🏫 Teacher Moves - Say the order conditions are checked. - Say which branch runs. - Complete the exit ticket. #### 🎒 Student Actions - Say it. - Say. - Complete the exit ticket. ## Built to the standards you report on Aligned to the CSTA K-12 Computer Science Standards and the ISTE Standards for Students. Iteratively develop programs using conditionals. Combine control structures to express ideas in code. Evaluate and refine computational artifacts. Use logic to build solutions. ## One lesson, every learner ### Multilingual Learners - Flowchart the branches. - Frame: if-then-otherwise. - Trace with sample scores. ### Support & Access - Use if/else only (2 paths). - One threshold to start. - Use a number line. ### Stretch & Extend - Add nested conditionals. - Use AND/OR in a condition. - Handle edge cases. ### What to gather - 📽️Screen / board - 🔀Branch cards - 💻Order the Grade-Checker - 🐍Python / editor - 📓Notebooks - 🎫Exit-ticket slips ### Key terms - **conditional**: code that chooses a path - **if**: runs a block when its test is true - **elif**: else-if: checked only if earlier tests fail - **else**: runs when no earlier test was true - **condition**: a test that is true or false - **branch**: one possible path through the code - **evaluate**: to work out true or false - **top to bottom**: the order Python checks conditions ## Exit Ticket Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students. ### Reflect: conditionals. Have students write a 3-branch if/elif/else for a real decision. A printable conditionals worksheet is in the Computer Science library. ## Check your understanding **1. What does “conditional” mean?** - one possible path through the code - a test that is true or false - code that chooses a path *(correct)* - runs when no earlier test was true “conditional” means: code that chooses a path **2. Which word means: “runs a block when its test is true”?** - else - branch - if *(correct)* - condition “if” means: runs a block when its test is true **3. What does “elif” mean?** - else-if: checked only if earlier tests fail *(correct)* - the order Python checks conditions - runs when no earlier test was true - a test that is true or false “elif” means: else-if: checked only if earlier tests fail **4. Which word means: “runs when no earlier test was true”?** - top to bottom - evaluate - condition - else *(correct)* “else” means: runs when no earlier test was true **5. What does “condition” mean?** - a test that is true or false *(correct)* - one possible path through the code - code that chooses a path - runs a block when its test is true “condition” means: a test that is true or false **6. Which word means: “one possible path through the code”?** - elif - branch *(correct)* - conditional - if “branch” means: one possible path through the code ## Printable worksheet --- Full lesson page: https://lessonplans.k12academics.com/k12-lesson-g9-cs-conditionals.html All lessons: https://lessonplans.k12academics.com/