Introduction
Dictionaries are ubiquitous, no doubt due to their usefulness and flexibility. Dictionaries store information in key/value pairs—we look up a value in a dictionary by its key. In this chapter we’ll learn about dictionaries: how to create them, modify them, iterate over them and so on.
Learning objectives
- You will learn how to create a dictionary.
- You will understand that dictionaries are mutable, meaning that their contents may change.
- You will learn how to access individual values in a dictionary by keys.
- You will learn how to iterate over dictionaries.
- You will understand that dictionary keys must be hashable.
Terms and Python keywords introduced
del
- dictionary
- hashable
- key
- value
- view object
Copyright © 2023–2025 Clayton Cafiero
No generative AI was used in producing this material. This was written the old-fashioned way.