June 2021
Beginner
336 pages
7h 11m
English

A Python list is useful whenever we need to store a sequence of values, such as the heights of action figures or the words in an essay. Lists make it easy for us to keep values in order and access a value given its index. As we’ll see in this chapter, though, there are operations that lists are not optimized for, including identifying whether a specific value is in a collection and making associations between pairs of values.
In this chapter, we’ll learn about Python sets and dictionaries, two alternatives to lists for storing collections of values. We’ll see that a set can be the tool of choice when ...