Day 8 - Iteration (Loops) - Part 1

Day 8: Iteration (Loops) - Part 1

Learning Objectives

Essential Questions

Materials Needed

Vocabulary

Procedure (50 minutes)

Opening (8 minutes)

  1. Review and Connection (3 minutes)

    • Review Boolean logic and compound conditions from previous lesson
    • Connect to today's focus on repeating actions with loops
  2. Warm-up Activity (5 minutes)

    • Present a task that requires repetition (e.g., adding numbers 1 through 10)
    • Ask students to write out the steps to complete this task without loops
    • Discuss the inefficiency of writing repetitive code

Main Activities (32 minutes)

  1. Lecture: Introduction to Iteration (12 minutes)

    • Define iteration as a programming construct that repeats a set of statements
    • Explain the importance of loops for efficiency and code readability
    • Introduce count-controlled loops (for loops):
      • Structure and syntax: REPEAT n TIMES
      • How the loop counter works
      • Execution flow in a loop
      • When to use count-controlled loops
    • Demonstrate how loops execute step by step
    • Explain common patterns and use cases for for loops:
      • Repeating an action a specific number of times
      • Processing items in a sequence
      • Generating sequences or patterns
    • Discuss the concept of the loop body and loop control
  2. Demo: Count-controlled Loops (For Loops) (8 minutes)

    • Walk through examples of programs with for loops:
      • Summing numbers from 1 to n
      • Printing patterns
      • Performing calculations multiple times
    • Show how to trace the execution of loops step by step
    • Demonstrate how the loop counter changes with each iteration
    • Highlight common patterns and techniques with for loops
    • Show how to use the loop counter within the loop body
  3. Hands-on: Implementing For Loops in Code (12 minutes)

    • Students work in the programming environment
    • Guide students through creating programs with for loops
    • Have students implement programs for scenarios like:
      • Calculating factorial of a number
      • Generating multiplication tables
      • Creating patterns of symbols
      • Computing sums or averages
    • Encourage students to trace their loops manually to understand execution flow

Closing (10 minutes)

  1. Activity: Using Loops to Process Collections of Data (5 minutes)

    • Provide students with a simple data set (e.g., list of numbers)
    • Students write a loop to process the data (find sum, average, maximum, etc.)
    • Share and discuss different approaches
    • Highlight how loops make data processing efficient
  2. Exit Ticket and Preview (5 minutes)

    • Students write programs that use for loops to solve problems
    • Preview that next class will focus on condition-controlled loops (while loops)

Assessment

Differentiation

For Advanced Students

For Struggling Students

Homework/Extension

Teacher Notes