AP CSP CodeX - Traversing a List Lesson 1
Traversing a List Lesson 1
Students traverse a list with a for loop in three programs, including traversing a list more than once.
Overview
Students work on computers in the CodeSpace Sandbox. This lesson is not part of a mission. Students add functions to Answer_Bot and Billboard and modify Game_Spinner so each program traverses a list. They compare a for loop with a specialized for loop, use modulo division to traverse a list more than once, and complete the Wrap-Up questions on the Activity Guide.
🎯 Mission Goal: Students will traverse a single list using a for loop in a program.
Learning Targets
- I can traverse a list using a for loop.
- I can traverse a list using a specialized for loop.
- I can traverse a list multiple times without getting an index out of range error.
Key Concepts
- Traversing a list means accessing each element in a list, in order.
- The easiest way to traverse a list is to use a for loop.
- Use a specialized for loop to traverse a list one time.
- You can traverse a list multiple times using a for loop.
Assessment Opportunities
- Traversing a List Lesson 1 Activity Guide
- Answer_Bot_traversal program
- Billboard_traversal program
- Game_Spinner_traversal program
Success Criteria
- Traverse a list using a for loop
- Traverse a list using a specialized for loop
- Traverse a list multiple times using a for loop and the modulo operator
Digital Resources
- ▸Traversing a List Lesson 1 slides
- ▸Traversing a List Lesson 1 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
- Make sure students can open their Answer_Bot_parameters, Billboard_functions, and Game_Spinner programs in the CodeSpace Sandbox. Students who need the original code can use the most recent version of each program from the class dashboard.
- 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 add functions to Answer_Bot and Billboard, and also modify the Game_Spinner program.
- The best experience will come from students modifying their own code. However, we want all students to be engaged, so you can give them the original code to modify if needed.
- The most recent version of each program can be found in the class dashboard. If you are giving code to students, use the solution code from these lessons:
- Answer_Bot_parameters: Unit 3 Functions with Parameters Lesson 2
- Billboard_functions: Unit 2 Mission 7
- Game_Spinner: Unit 3 Mission 9 (with or without modulo)
- 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 lists with students.
- Slide 2: Students write down at least three things about lists in their Activity Guide. You can have them do a think-pair-share, etc.
💻 Students do not need a computer for this part. They can take notes or have a discussion as needed.
💻 Students use the Answer_Bot_parameters program from Unit 3 Functions with Parameters Lesson 2.
💻 Students use the Billboard_functions program from Unit 2 Mission 7 (not the one with parameters).
💻 Students use the Game_Spinner program from Unit 3 Mission 9. Students can use the original version or the one with modulo.
💻 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