Lesson 2.06: Lists 2
Learning Objectives
Students will be able to...
- Define and identify: slice, append, pop, remove
- Slice a list
- Add and remove elements from a list
Materials/Preparation
- Do Now
- Lab - Tic-Tac-Toe
- Associated Reading - section 2.5 of Book
- Read through the do now, lesson, and lab so that you are familiar with the requirements and can assist students
Pacing Guide
Duration | Description |
---|---|
10 Minutes | Do Now |
10 Minutes | Lesson |
30 Minutes | Lab |
5 Minutes | Debrief |
Instructor's Notes
- Do Now
- Students may need more time than usual to fully go through this lesson's Do Now.
- Lesson
- Ask students what doing
a[0:2]
in the Do Now did.- Define slicing: a list operation that gives back a list starting from the index to the left of the colon and going up to the index to the right of the colon.
- Note that slicing doesn't exist in Snap!
- Ask students what the list would return if you did
a[1:2]
. - Explore the differences between
remove
andpop
, asking for student input. - Ask students what the plus sign and
append
do to a list. - Ask students to write down or brainstorm how they would represent a Tic-Tac-Toe board using lists.
- Create a Tic-Tac-Toe board with students in class.
- Ask students what doing
- Lab
- Students practice slicing, adding, and removing elements from some given lists.
- Students create a single move Tic-Tac-Toe game
- Debrief
- Check student progress and completion of the lab, wrap up by taking any final questions.
Accommodation/Differentiation
If students are moving quickly, start the next topic of using a while loop as a game loop. Explore the concept of keeping score for the game.
If students are moving slowly then spend an extra day reviewing lists and completing lab activities.
There is also an opportunity for a quiz after the game loop lesson and before the project.