4 Built-In Data Structures Part 1: Lists and Sets

Python has a rich collection of built-in data structures. These data structures are sometimes called ”containers” or ”collections” because they contain a collection of individual items. These structures cover a wide variety of common programming situations.

We’ll look at an overview of the various collections that are built in and what problems they solve. After the overview, we will look at the list and set collections in detail.

The built-in tuple and string types were part of Chapter 1, Numbers, Strings, and Tuples. These structures are sequences, making them similar in many ways to the list collection. However, strings and tuples seem to have more in common with immutable numbers.

The next ...

Get Modern Python Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.