Skip to main content

Lists and loops: storing and processing collections

Lesson time ~30 min · 3 skills · Grades 7–10

What you’ll learn

  1. Iterating a list with a for-each loopNot started

    Use a for-each (for item in list) loop to visit every element in order and perform a simple action such as printing each value.

  2. Modifying a list: append and removeNot started

    Add new items to the end of a list with append() and remove an item by value or index. Observe how the list changes after each operation.

  3. Accumulating a result while iteratingNot started

    Initialize a counter or running total before a loop, update it inside the loop for each element, and report the final result after the loop ends.

Before you start

You should already know

  • Variables and assignment
  • Basic loop syntax
  • Conditionals

Skills this builds on

  • Creating and indexing a list
  • Checking list length
Notes for teachers

Start with a concrete, tangible analogy: a list is like a numbered shelf where each slot holds one item. Use a shared class example (e.g., a list of favorite foods) so all learners work with the same data throughout. Introduce prereq_001 and prereq_002 together in a single hands-on activity before moving to loops. When teaching core_001, emphasize that the loop variable is a temporary copy of each element, not the element itself—a common misconception. The accumulator pattern in core_003 should be scaffolded with a physical counting exercise (e.g., tallying on paper) before coding. For core_004, have learners predict which items will pass the filter before running the code to build conditional reasoning. The extension skill is optional and best assigned as a take-home challenge or early-finisher task; it should not be attempted if the class has not solidly mastered core_002 and core_003. Avoid introducing list slicing, nested lists, or list comprehensions in this session—they belong in a follow-up unit.

How this module was checked

Status: Approved