Think in Tables
Explore how to model real-world data in Python by combining dictionaries into lists to form tables. Learn to store and manage collections of related items such as people, books, or grades through practical examples.
We'll cover the following...
You’re now comfortable storing things with dictionaries. Let’s now combine dictionaries into a list so that Python can remember a whole group of things, like a list of people, books, or grades.
This structure helps us model real-world tables in code.
List of people as a table
Let’s look at the code below:
That’s our first data table!
Why are there lists of dictionaries?
Each dictionary represents one item, like a row in a table. The list is the collection of all items (rows).
Perfect for things like:
Students in a class
Products in a store
Animals in a shelter
Your turn: Build a library
Add more books or change the titles!
Nice work! You just modeled real-world data in Python—that’s a big step forward!