Data Structures · Lesson 34 of 76
Data structures
A data structure holds many values together. Python's four everyday ones, and when to reach for each:
- list
[ ]— an ordered collection you can change. Use for: a sequence of things, like prices. - tuple
( )— like a list but can't change. Use for: fixed groups, like a coordinate. - dict
{key: value}— labelled values. Use for: describing one thing, like a student. - set
{ }— unique values, no duplicates. Use for: "which different items appeared?"
Python
The next lessons take tuples and sets one at a time.
Your turn: add a second name to the student dict, like "track".
You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →