SubstitutePlans.com · Teacher phone guide
Conditionals: Tracing If, Else If and Else
Teacher directions only. Student worksheets and the answer key are in the complete teacher PDF. This downloaded guide opens offline.
CONDITIONALS: TRACING IF, ELSE IF AND ELSE Grades 7-10 | 45 minutes | SP-CS-022 THE GOAL Students explain how a program uses conditions to make decisions, read comparison operators, and trace if, elif (else if) and else chains by hand to predict exactly which branch runs. BEFORE THE BELL Copy the reading and worksheet (pages 3-5) for each student. Write the warm-up question on the board before class. - Student reading (page 3) - Worksheet (pages 4-5) - Pencils - Scrap paper for tracing STEP BY STEP 1. (5 min) Warm-up: Post this question: "You check the weather before school. Write the rule you use to decide what to wear, starting with the word IF." Students write one or two rules. Call on two volunteers to read theirs aloud. 2. (12 min) Read: Hand out the reading. Students read silently and circle every comparison operator they see (such as >, >= and ==). Offer to read the first paragraph aloud for anyone who wants it. 3. (18 min) Worksheet: Students complete questions 1-11. For tracing questions, tell them to check each condition from the top, write True or False next to it, and stop at the first True. 4. (5 min) Partner check: Partners compare answers to the tracing questions (4-10). If they disagree, they trace the code together one line at a time, writing True or False beside each condition. 5. (5 min) Exit ticket: Students answer the exit ticket at the bottom of the worksheet. Collect everything in one stack. NOTES FOR YOU - You do not need to know how to code. The answer key gives every output, and the method (check each condition top to bottom, stop at the first True) is all students need. - The most common mistake: thinking more than one branch of an if/elif/else chain can run. Only the first True branch runs; everything below it is skipped. - Watch for students who say 90 > 90 is True. It is False; 90 >= 90 is True. Question 5 and the exit ticket test this on purpose. EXIT TICKET (read aloud or post) In the weather code from question 4, what prints when temp = 70? Explain in one sentence. EARLY FINISHERS Early finishers write an if/elif/else chain for a movie theater that prints "Child" for ages under 13, "Teen" for 13 to 17 and "Adult" for 18 and up, then trace it for ages 12, 13 and 18. PAGES TO COPY: only pages marked STUDENT PAGE in the complete PDF. Answers are on the last teacher page.