Lesson: Dictionaries Looping

Learning Objectives

Students will be able to...

  • Loop through dictionaries

Materials/Preparation

  • Do Now
  • Lab
  • Associated Reading - section 5.4 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 returned. How can lists be used with a for loop.
    • Asks students about part 2 of the Do Now.
      • Ask students to write their solution no the board.
      • Disucss that it is possible to do just for key in my_dictionary..., but this behind the scenes is similar to calling the keys function.
      • Discuss that the order is not exactly what was expected.
      • Unlike lists dictionaries have no guaranteed order
  3. Lab
    • Students will rewrite their word count lab to return the top 5 most used words
  4. Debrief
    • Talk about any confusion the students had.
    • Talk about how in works for dictionaries for the bonus