All courses
· beginner

Data Structures in Python

Lists, dictionaries, sets and tuples, and knowing which to reach for. Comprehensions, the mutability traps that catch everyone, and why a dictionary lookup beats a loop.

Pathaxis · Original content

Written in house, from the work rather than from a syllabus. Every example is one we would use ourselves, and every exercise is checked against the same engine that grades your answer.

84 min 6 lessons 20 quiz questions 6 exercisesStart course

What you’ll learn

  • Choose between a list, dict, set and tuple deliberately
  • Use dictionaries for lookups instead of scanning a list
  • Remove duplicates and compare collections with sets
  • Write comprehensions that stay readable
  • Avoid the mutable default and shared reference traps
  • Sort and group data without reaching for a library

Before you start

  • · Python Foundations, or comfort with variables, loops and conditionals

Syllabus

01

The four structures

What each one is for, and the cost of the wrong choice.

02

Transforming collections

Comprehensions, sorting and grouping.

03

Traps

Mutability, references and the bugs they cause.