Overview

Practice the basics of lists including creating lists and accessing, inserting, and removing elements from lists.

Goals

Students will be able to:

Purpose

This lesson is students primary opportunity to get hands on with lists in code prior to the Make activity in the following lesson. Give students as much class time as you can to work through these. For this lesson it's recommended that you place students in pairs as a support and to encourage discussion about the challenges or concepts they're seeing.

Getting Started (5 mins)

Do This: Run a quick vocabulary review with students.

Remarks

Activity

Review: Remind students of the debugging process, including some of these important skills:

Display: Quickly introduce the fact that strings have indexes too. Students will see text:GetSize() and text:GetSubtext(start, end) during the lesson so this is just calling out a concept that students will need to recognize when they get to it. You may optionally use slide 46 from CSP Unit 5 Presentation Slides to present this information. While the slide uses Javascript instead of Quorum, the concept is the same in both languages.

Open a Project: Students will be using a number of projects to practice today. Direct students to begin with Lesson3_App1 of Unit 5 in the CSP-Widgets repository.

Teaching Tip

Providing Support: Circulate around the room through the lesson encouraging students to use the strategies introduced at the beginning of the lesson. Students have a number of supports at their fingertips, so a big part of your role is helping build their independence in using those resources.

Common Errors: The following are common errors students may encounter in this lesson:


Apps 1-2 Setting Up Lists: These levels involve setting up a list and printing the list to the console.

Apps 3-5 Accessing Elements in a List: Students practice accessing elements in a list using the index. These levels also practice the random list access and list scrolling pattern students saw in the Investigate lesson.

App 6-7 Strings and Indexes: Students practice accessing characters in a string.

Apps 8-11 List Operations: In these levels, students work with list operations: Add(element), RemoveAt(index), and Add(index, element).


Teaching Tip

Extension Opportunities:


Wrap Up

Goal: Use this opportunity to address any lingering questions or misconceptions in the room. You can also use this as a source of discussion topics to kick off the following lesson. As you lead the discussion, call out the many resources students have access to help when they're getting stuck.

Prompt: What aspects of working with lists do you feel like clicked today? What do you still feel like you have trouble with?

Discuss: Have students share with one another before sharing with the whole class.

Remarks

Assessment: Check for Understanding: AP Practice

Question: What will be displayed after this code segment is run?

gems <- ["ruby", "sapphire", "garnet"]
gems <- ["opal", "emerald"]
DISPLAY(gems[2])

Question: What will be displayed after this code segment is run?

luckyNumbers <- [15, 33, 25]
INSERT(luckyNumbers, 2, 13)
APPEND(luckyNumbers, 3)
REMOVE(luckyNumbers, 1)
DISPLAY(LENGTH(luckyNumbers))

Standards Alignment