Skip to main content

Documentation Index

Fetch the complete documentation index at: https://python.datalumina.com/llms.txt

Use this file to discover all available pages before exploring further.

Beyond single values

So far, you’ve stored one value per variable. But what if you need to store multiple values? That’s where data structures come in. Think of data structures as containers:
  • Lists: Like a shopping list (ordered items)
  • Dictionaries: Like a phone book (name > number)
  • Tuples: Like coordinates (fixed values)
  • Sets: Like a bag of unique items

The main structures

Lists

Ordered, changeable collections

Dictionaries

Key-value pairs for fast lookup

Tuples

Ordered, unchangeable collections

Sets

Unique values only

Which one to use?

  • Lists: When order matters and you need to change items
  • Dictionaries: When you need to look up values by name
  • Tuples: When data shouldn’t change (like coordinates)
  • Sets: When you only care about unique values
Python counts from 0, not 1! The first item in any collection is at position 0, the second at position 1, and so on. This is called “zero-based indexing” and you’ll see it throughout Python.

Start learning

Lists are the most common data structure - let’s start there!

Learn about lists

Your first data structure