# Loops > Ninth graders learn loops — a for loop repeats a set number of times; a while loop repeats until a condition becomes false. They match loop terms to… **Computer Science** | **Grade 9** *A free lesson plan from K12 Academics. Source page: https://lessonplans.k12academics.com/k12-lesson-g9-cs-loops.html* Ninth graders learn loops — a for loop repeats a set number of times; a while loop repeats until a condition becomes false. They match loop terms to meanings, then write loops to avoid repeating themselves. **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… - Tell **for** from **while**. - Use **range()**. - Avoid an **infinite loop**. - Replace repetition with a loop. How do loops let a program repeat work without copy-paste? ## Match the Loop Term Project this and match each loop term to its meaning — tap the term, then tap the meaning. ## 55 minutes, five moves Tap any phase to open the teacher moves and student actions. ### Hook — Say It 10 Times How would you print a word ten times without 10 lines? #### 👩‍🏫 Teacher Moves - Show 10 copy-pasted lines. - Ask for a shorter way. - Set the goal. #### 🎒 Student Actions - Look. - Guess. - Get ready. ### Use — Loops Students use loops. #### 👩‍🏫 Teacher Moves - Send students to Match the Loop Term. - Match each one. - Note for vs while. #### 🎒 Student Actions - Match. - Say. - Note it. ### Modify — Change the Count Students modify. #### 👩‍🏫 Teacher Moves - Change range(5) to range(10). - Convert a for to a while. - Spot an infinite loop risk. #### 🎒 Student Actions - Change. - Convert. - Spot. ### Create — Loop It Students create. #### 👩‍🏫 Teacher Moves - Replace 5 repeated lines with a loop. - Loop over a list. - Test the output. #### 🎒 Student Actions - Replace. - Loop. - Test. ### Reflect — Reflect Students close. #### 👩‍🏫 Teacher Moves - Say when to use for vs while. - Say what causes an infinite loop. - 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 loops. Combine control structures to express ideas in code. Evaluate and refine computational artifacts. Automate repetition to solve problems. ## One lesson, every learner ### Multilingual Learners - Clap-count a loop. - Frame: repeat N times. - Trace a loop by hand. ### Support & Access - Start with for + range. - Small counts (3). - Use a counter chart. ### Stretch & Extend - Nest two loops. - Use while with user input. - Loop with a break condition. ### What to gather - 📽️Screen / board - 🔄Loop term cards - 💻Match the Loop Term - 🐍Python / editor - 📓Notebooks - 🎫Exit-ticket slips ### Key terms - **loop**: code that repeats - **for loop**: repeats a set number of times - **while loop**: repeats until a condition is false - **range()**: a sequence of numbers to loop over - **iteration**: one pass through the loop - **counter**: a variable that tracks repeats - **infinite loop**: a loop that never ends (a bug) - **body**: the code that repeats inside a loop ## Exit Ticket Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students. ### Reflect: loops. Have students rewrite 5 repeated lines as one loop. A printable loops worksheet is in the Computer Science library. ## Check your understanding **1. What does “loop” mean?** - code that repeats *(correct)* - one pass through the loop - repeats until a condition is false - a loop that never ends (a bug) “loop” means: code that repeats **2. Which word means: “repeats a set number of times”?** - for loop *(correct)* - while loop - counter - loop “for loop” means: repeats a set number of times **3. What does “while loop” mean?** - repeats until a condition is false *(correct)* - one pass through the loop - a loop that never ends (a bug) - the code that repeats inside a loop “while loop” means: repeats until a condition is false **4. Which word means: “a sequence of numbers to loop over”?** - range() *(correct)* - loop - iteration - body “range()” means: a sequence of numbers to loop over **5. What does “iteration” mean?** - repeats a set number of times - one pass through the loop *(correct)* - a loop that never ends (a bug) - code that repeats “iteration” means: one pass through the loop **6. Which word means: “a variable that tracks repeats”?** - counter *(correct)* - while loop - loop - for loop “counter” means: a variable that tracks repeats ## Printable worksheet --- Full lesson page: https://lessonplans.k12academics.com/k12-lesson-g9-cs-loops.html All lessons: https://lessonplans.k12academics.com/