Dictionaries and Sets

Learning Objectives

By the end of this chapter, you will be able to:

  • Create and use dictionaries
  • Use methods and attributes associated with dictionaries
  • Describe and use ordered dictionaries to store and retrieve data in a predictable order
  • Create sets, as well as add, read, and remove data from them
  • Describe the attributes defined on set objects
  • Describe frozen sets

This lesson describes dictionaries and sets. We cover creating, reading, and writing data to these data structures.


You have already seen lists that hold values that you can access by using indexes. However, what if you wanted to name each value, instead of using an index? For example, suppose that you want to access a list of cake ingredients, ...

Get Python Fundamentals now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.