Lesson: Dictionaries of Lists

Learning Objectives

Students will be able to...

  • Create dictionaries with keys of different types and values of different types
  • Update list values in a dictionary

Materials/Preparation

  • Do Now
  • Lab
  • Associated Reading - section 5.3 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
5 Minutes Do Now
10 Minutes Lesson
30 Minutes Lab
10 Minutes Debrief

Instructor's Notes

  1. Do Now
    • Display the Do Now on the board
  2. Lesson
    • Ask the students about part 1 of Do Now
      • What type is list_dictionaries. It is still a dictionary type which goes from string to list. Dictionaries can also go from numbers to lists or numbers to strings any combination.
    • Asks students about part 2 of the Do Now.
      • How do you update a value within a dictionary. Have to first get the item. If it doesn't exist set it to empty. If it does exist append a value to the end.
      • Have students practice adding and removing values from a dictionary that goes from strings to lists.
  3. Lab
    • Students will create a weekly to do list. The user can add items to the to do list.
  4. Debrief
    • Talk about any confusion the students had.
    • Talk about how in works for dictionaries for the bonus