Day 16 - Introduction to Lists/Arrays

Day 16: Introduction to Lists/Arrays

Learning Objectives

Essential Questions

Materials Needed

Vocabulary

Procedure (50 minutes)

Opening (8 minutes)

  1. Review and Week 4 Introduction (3 minutes)

    • Review modular program design from previous lesson
    • Introduce Week 4 focus on data structures and algorithms
    • Connect to today's focus on lists as a fundamental data structure
  2. Warm-up Activity (5 minutes)

    • Present a scenario requiring storage of multiple related values (e.g., student grades)
    • Ask students how they might store this data using what they know so far
    • Discuss limitations of using individual variables
    • Introduce the need for collections of data

Main Activities (32 minutes)

  1. Lecture: Lists/Arrays as Data Structures (12 minutes)

    • Define lists as ordered sequences of elements
    • Explain the concept of data abstraction using lists
    • Discuss list terminology:
      • Element: individual value in a list
      • Index: position of an element in a list
      • Length: number of elements in a list
    • Explain list representation in pseudocode:
      • Creating lists: aList ← [value1, value2, value3, ...]
      • Empty lists: aList ← []
    • Discuss list indexing (starting at 1 in AP CSP pseudocode)
    • Explain basic list operations:
      • Accessing elements: aList[i]
      • Assigning values: aList[i] ← x
      • Getting list length: LENGTH(aList)
    • Discuss how lists provide data abstraction:
      • Treating multiple values as a single unit
      • Hiding implementation details
      • Representing complex data structures
  2. Demo: Creating and Accessing List Elements (8 minutes)

    • Walk through examples of creating and using lists:
      • Creating lists with different data types
      • Accessing elements by index
      • Modifying list elements
      • Working with list lengths
    • Demonstrate common list patterns:
      • Initializing lists
      • Accessing first and last elements
      • Updating elements
      • Working with lists of different data types
    • Show how lists can represent real-world collections
    • Highlight common errors with list indexing
  3. Hands-on: Manipulating Lists in Code (12 minutes)

    • Students work in the programming environment
    • Guide students through creating and manipulating lists
    • Have students implement programs that:
      • Create lists of different types (numbers, strings, etc.)
      • Access and modify list elements
      • Perform calculations with list elements
      • Solve problems using lists (finding max/min, calculating averages, etc.)
    • Encourage students to experiment with different list operations

Closing (10 minutes)

  1. Activity: Solving Problems Using Lists (5 minutes)

    • Present students with problems that can be solved using lists
    • Students design and implement solutions
    • Share and discuss different approaches
    • Highlight how lists simplify working with collections of data
  2. Exit Ticket and Preview (5 minutes)

    • Students complete exercises involving list creation and manipulation
    • Preview that next class will focus on list operations and algorithms

Assessment

Differentiation

For Advanced Students

For Struggling Students

Homework/Extension

Teacher Notes