AP CSP CodeX - Traversing a List Lesson 3
Traversing a List Lesson 3
Students traverse a list to check if an item is in the list, and to filter a list into a sub-list.
Overview
Students work on computers in the CodeSpace Sandbox. This lesson is not part of a mission. Students create three new programs: Class_Schedule, Number_Sorter and Animal_Sorter. Each program is fairly short. Students traverse a list to check if an item is in the list, fill lists using append() and input from the Console panel, and filter a list to create a sub-list. They complete the Wrap-Up questions on the Activity Guide.
🎯 Mission Goal: Students will traverse a list to check if an item is in the list, and to filter the list.
Learning Targets
- I can use the console panel to input data.
- I can traverse a list and check if a given answer is in the list.
- I can create a list by appending random numbers.
- I can create a list by appending input from the user.
- I can filter a list to create a sub-list.
Key Concepts
- An empty list can be filled with data by using the append() function.
- The console panel can be used for input as well as output.
- The input() function returns a string. If an integer is needed, it must be converted using int().
- The display.print() function uses strings. To print an integer, convert it using str().
Assessment Opportunities
- Traversing a List Lesson 3 Activity Guide
- Class_Schedule program
- Number_Sorter program
- Animal_Sorter program
Success Criteria
- Use input() and the console panel to fill a list
- Fill an empty list using append()
- Traverse a list and check if an item is in the list
- Traverse a list to filter by a condition, creating a sub-list
- Traverse a list and filter by checking each item, comparing it to a second list
Digital Resources
- ▸Traversing a List Lesson 3 slides
- ▸Traversing a List Lesson 3 Activity Guide
- ▸Code Solutions and Assignment Answers - Teacher Dashboard > Educator Resources button
Classroom Materials
- ▸CodeX
- ▸USB-C cable
- ▸Computer
Extensions & Cross-Curricular
🔤
Vocabulary
▾
🐍
New Python Code
▾
📐
Standards
▾
CSTA Standards - Grades 9-10
CSTA Standards - Grades 11-12
AP CSP Framework
- Prepare the Activity Guide to give to students. It is used for notes during the lesson and for the Wrap-Up questions at the end.
- If you have a word wall, or another form of vocabulary presentation, prepare the terms.
- Students complete this lesson on the computer, using the Sandbox in CodeSpace for programming. This lesson is not part of a mission.
- Students create three new programs. Each program is fairly short. The programs are:
- Class_Schedule
- Number_Sorter
- Animal_Sorter
- Solution code for all finished programs is provided.
- Follow the slides for instructions and guidance.
Lesson Outline
This outline gives one way to present the lesson.
Review loops and list traversal with students. Slide 2: Students answer the questions in the Activity Guide.
- Discuss how you create a list and access an element in the list.
- Discuss how you traverse a list.
- Discuss the structure of a for loop.
💻 Students create a new program and can take notes in the Activity Guide.
💻 Students create a new program and can take notes in the Activity Guide.
💻 Students create a new program and can take notes in the Activity Guide.
💻 Slides 29-31: Students do not use the computer for this activity.
✅ The Activity Guide and three programs are complete and ready to turn in.
✅ Formative assessment:
- "Wrap Up" questions at the end of the Activity Guide
- Daily reflection journal or Google Form
- Class discussion on what they learned about lists
- Exit ticket