Editor

Access Nested List Items

Beginner · Write the code · from Working with Nested Lists, Dicts, and Complex Data Structures

From the lesson: Working with Nested Lists, Dicts, and Complex Data Structures

Think about a school. A school has classrooms. Each classroom has students. Each student has a name, an age, and a list of grades. That's data inside data inside data - nested data.

Read the lesson

You have a 3x3 grid of numbers. Print the center value (row 1, column 1), then print the bottom-right value (row 2, column 2). Each on a separate line.

grid = [
[10, 20, 30],
[40, 50, 60],
[70, 80, 90],
]
# Print the center value
# Print the bottom-right value

More nested data exercises

All Python exercises · 50 practice problems · Data Structures quiz