Python lists, tuples and dictionaries: when to use each
Python lists, tuples and dictionaries compared with simple examples: how each one works, how they differ, and a quick rule for picking the right one.

Lists, tuples and dictionaries are the three collections you will use in almost every Python program. They all hold several values in one variable, so beginners often wonder why Python has three of them and which one to pick.
The short answer: use a list for an ordered collection that changes, a tuple for a fixed group of values, and a dictionary when you want to look things up by name. The rest of this post shows what that means in practice.
If you are still getting started with Python, our Python roadmap for beginners shows where these collections fit in your first 30 days.
The quick comparison
| List | Tuple | Dictionary | |
|---|---|---|---|
| Syntax | [1, 2, 3] | (1, 2, 3) | {"a": 1, "b": 2} |
| Ordered | Yes | Yes | Yes (by insertion) |
| Can change after creation | Yes | No | Yes |
| Access by | Position (items[0]) | Position (point[0]) | Key (user["name"]) |
| Duplicates allowed | Yes | Yes | Keys must be unique |
| Best for | A collection that grows or shrinks | A fixed group of related values | Labeled data |
The two properties that matter most are mutable (can it change?) and how you access items (by position or by key). Everything else follows from those.
Lists: an ordered collection you can change
A list is the default choice. Items stay in order, you can add and remove them, and you can have as many as you like.
fruits = ["apple", "banana", "cherry"]
print(fruits[0]) # apple
fruits.append("mango") # add to the end
fruits.remove("banana") # remove by value
fruits.sort() # sort in place
print(fruits) # ['apple', 'cherry', 'mango']Reach for a list when:
- The number of items can change, like a shopping cart or a to-do list.
- Order matters, like a queue of tasks.
- You want to loop over many similar items.
The beginner lessons cover each of these moves: Introduction To Lists (opens in a new tab), Indexing (opens in a new tab), Adding To A List (opens in a new tab) and Removing From A List (opens in a new tab).
Tuples: a fixed group of values
A tuple looks like a list with parentheses, but you cannot change it after you create it.
point = (3, 7)
print(point[0]) # 3
point[0] = 10 # TypeError: 'tuple' object does not support item assignmentThat restriction is the feature. A tuple tells anyone reading your code, and Python itself, that these values belong together and should not change. Reach for a tuple when:
- The values form one thing, like
(latitude, longitude)or(red, green, blue). - A function returns more than one value.
- You need a value that never changes, which also lets a tuple be used as a dictionary key.
Tuples pair nicely with unpacking, which splits a tuple into separate variables:
latitude, longitude = (51.5, -0.12)
print(latitude) # 51.5Tuples and unpacking are covered in Tuples (opens in a new tab) and Unpacking (opens in a new tab).
Dictionaries: labeled data you look up by key
A dictionary stores key-value pairs. Instead of asking "what is at position 2?", you ask "what is the value for email?"
user = {"name": "Ada", "age": 28, "city": "London"}
print(user["name"]) # Ada
user["age"] = 29 # update a value
user["language"] = "Python" # add a new pair
print(user.get("phone", "n/a")) # n/a, no error for a missing keyReach for a dictionary when:
- Each value has a meaningful name, like a user profile or a settings object.
- You need fast lookup by an ID, a word or a code.
- You are counting or grouping things, like how many times each word appears.
To learn dictionaries step by step, start with What Is A Dictionary (opens in a new tab), then Accessing Values (opens in a new tab), Dictionary Lookup (opens in a new tab) and Looping Dictionaries (opens in a new tab).
How to choose: three questions
When you are not sure which collection to use, ask these in order:
- Do I need to find items by a name or ID? Use a dictionary.
- Should the values stay fixed once created? Use a tuple.
- Otherwise, will it grow, shrink or change? Use a list.
Here is one small example that uses all three. A list holds many students, each student is a dictionary, and each student's scores are stored in a tuple:
students = [
{"name": "Ada", "scores": (90, 85, 98)},
{"name": "Linus", "scores": (72, 88, 80)},
]
for student in students:
print(student["name"], max(student["scores"]))The list can grow as new students join. The dictionary labels each piece of data. The tuple keeps a student's three scores together as one unit. Real programs mix collections like this all the time, and Nested Lists (opens in a new tab) and Nested Dictionaries (opens in a new tab) show you how.
Common mistakes
- Using a list when you need labels. If you catch yourself remembering that "index 2 is the email", switch to a dictionary.
- Forgetting the one-item tuple comma.
(5)is just the number 5. A one-item tuple is(5,). - Reading a missing dictionary key with
[].user["phone"]raises aKeyErrorif the key does not exist. Use.get()when the key might be missing. - Trying to change a tuple. If you need to change the values, use a list instead.
Frequently asked questions
Is a tuple faster than a list?
Slightly, but the difference rarely matters. Choose based on whether the data should change, not on speed.
Can a dictionary have duplicate keys?
No. Each key must be unique. If you assign to a key that already exists, the old value is replaced.
Are dictionaries ordered?
Yes. Since Python 3.7, dictionaries keep the order in which items were inserted. You still look values up by key, not by position.
Where to go next
You now know the rule of thumb: lists for collections that change, tuples for fixed groups, dictionaries for labeled data. The fastest way to make it stick is to practice. Try Lists Knowledge Check (opens in a new tab) and Dictionaries Knowledge Check (opens in a new tab), then build something small with all three.
When you are ready for more, Picking A Collection (opens in a new tab) goes deeper on choosing between collections, and the course adds sets and comprehensions. For the full path from your first line of code onward, follow the Python roadmap for beginners.







