AP CSP CodeX - Lists Lesson 2

Lists Lesson 2 Lesson Plan

Lists Lesson 2

Students work in groups to trace code that uses list indexes and list methods, then review with an Activity Guide.

⏰ 45 min 🎯 Grades 9-12 🎮 CodeX 🐍 Python
View Lesson Outline
📋

Overview

This unplugged lesson continues Lists Lesson 1. Working in groups, students trace three code examples (Example C, Example D, and Example E) that use list indexes and list methods. Example E uses a while loop to fill a list and another while loop to total the list items. The Lists Lesson 2 Activity Guide is used as a review after the group work.

🎯 Mission Goal: Students will evaluate code segments that involve lists and list methods.

🎯

Learning Targets

  • I can define and identify parts of a list.
  • I can access an element of a list.
  • I can evaluate code segments with lists and list methods.
💡

Key Concepts

  • A list can be used when you have, or could have, many similar variables.
  • A list has elements, or items, organized in order by number.
  • The number used to organize the elements is called an index.
  • Data in a list can be changed, removed, inserted, and used in calculations.
✅

Assessment Opportunities

☑️

Success Criteria

  • Define list vocabulary
  • Access and manipulate elements in a list
  • Evaluate list code segments
🧰

Classroom Materials

  • ▸Printed copies of the Group Code Tracing examples (one set per group)
  • ▸Optional: baggies, slips of paper, and pieces of paper or small whiteboards for creating a list mental model
🌍

Real-World Applications

✅To-do lists: People use these to manage daily tasks, work assignments, and household chores.
🛒Shopping lists: Shoppers write down items they need to buy before going to the store to save time and prevent forgotten items.
🎵Playlists: Music services arrange songs in a specific order so users can play their favorites back-to-back. The playlist can change from day to day.
🚀

Extensions & Cross-Curricular

ExtensionStudents write their own code tracing problem that uses append, insert, and pop, trade with another group, and compare answers.
ExtensionStudents change the number in the first while loop of Example E, predict how the final list, count, and total will change, then trace it to check.
MathStudents find the average of the items in the final elist from Example E and explain how len(elist) is used in the calculation.
Lang ArtsStudents use a daily reflection journal to explain list, index, element, and list length in their own words.
📐

Standards

▾

CSTA Standards - Grades 9-10

3A-CS-01 3A-AP-14

CSTA Standards - Grades 11-12

3B-AP-12

AP CSP Framework - Algorithms and Programming

AAP-1.C - Represent a list or string using a variable.
AAP-2.N - Evaluate expressions that use list indexing and list procedures.

AP CSP Framework - Computational Thinking Practices

3.A - Generalize data sources through variables.
4.B - Determine the result of code segments.
6.A - Collaborate in the development of solutions.
📝
Preparing for the Lesson
  • Print the Group Code Tracing examples (Example C, Example D, and Example E) for each student group.
  • The Activity Guide can be distributed digitally. It is used as a review after the group work.
  • Decide what warm-up or review your students need. See the Warm-up in the Lesson Outline for ideas.

🧑‍🏫
Teacher Notes
  • This lesson is best with partners or in groups of three.
  • Students do not work at computers for this lesson.
  • Example E uses a while loop to fill a list with items, and another while loop to get a total of all the list items. You may need to go over this with the students, or give an example first.
  • The Lesson Outline gives one way to present the lesson. Modify the slides (or lesson) as needed.
🗺️

Lesson Outline

This outline gives one way to present the lesson.

🗣️Warm-up

The purpose of the warm-up is to review Lists Lesson 1 and the shared mental model. The type of warm-up or review you choose depends on your students.

Ask students:

  • What do you remember about lists?
  • How do you define a list?
  • How do you access an element in a list?
  • How do you update an element in a list?
  • What are some list methods?
Teaching tip: You, as the teacher, need to determine the warm-up or review that your students need. It could be:
  • Practicing the mental model with another example, like student names
  • Going over Example A or Example B (or both)
  • Displaying the Lists Vocab slides
  • Giving an example using a loop
👥Group Practice

💻 Students will NOT work at computers for this lesson. Groups of three standing at vertical whiteboards work well. Print the three Tracing Examples in advance and have them ready for students to work through.

Teaching tip: Students have three examples to work through in their groups. They can do them in any order. They should compare their answers with other groups and discuss or re-work examples they do not agree on. The teacher can monitor and support as needed.

Answers to Examples:

  • Example C: Final clist = [4, 6, 11, 6, 7, 37, 20, 5]
  • Example D: Final dlist = [1, 1, 7, 1, 3, 5, 2]
  • Example E: Final elist = [2, 5, 6, 4, 3], count = 5, total = 20
🧑‍🤝‍🧑Wrap-Up

💻 Students complete the Activity Guide as a review of the concepts worked on today. They can work individually, with a partner, or even at the whiteboards (if you print the Activity Guide). If time permits, go over the answers, or have students check their answers with each other.

✅ Review assignment is complete and ready to turn in.

Formative assessment:

  • Lists Lesson 2 Activity Guide
  • Daily reflection journal
  • Class discussion on what they learned about lists
  • Exit ticket