Skip to content

Learn: Python Data Structures

Six short tutorials that build up your working knowledge of Python's built-in data structures from the ground up. Each one is a Jupyter notebook — read it in the browser, and edit and run any code cell directly on the page.

The tutorials build on each other, so working through them in order is the fastest path. Each takes roughly fifteen minutes.

The sequence

  1. Working with lists — creating lists, indexing, mutation, iteration.
  2. Working with tuples — immutable sequences, unpacking, named tuples.
  3. Working with dictionaries — key-value pairs, lookups, common patterns.
  4. Working with sets — unique collections, membership, set algebra.
  5. Comprehensions — building lists, dictionaries, and sets concisely.
  6. Slicing and unpacking — extracting and selecting data from sequences.

Before you start

You'll get more from these if you're already comfortable with Python variables, numbers, and if/else. If any of that feels shaky, the Conditional logic guide is a good warm-up.

You don't need Python installed locally — every tutorial runs in your browser. If you'd rather run them on your own machine, each notebook has a download button in the top-right corner.