CS
Tutor
Home
Grade 7
Grade 10
Playground
Leaderboard
Tutor
← Back to Nested Lists
How Nested Lists Work
Step through code to see how 2D lists are accessed and looped through
How Nested Lists Work
Accessing Elements
Looping Through Grid
Searching a Grid
1
grid = [
2
[
1
,
2
,
3
],
3
[
4
,
5
,
6
],
4
[
7
,
8
,
9
]
5
]
7
print
(grid[
0
])
8
print
(grid[
0
][
1
])
9
print
(grid[
2
][
0
])
Back
▶ Play
Step
Ready
What's Happening
Press Play or Step to begin
Output
No output yet
Legend
Outer loop (rows)
Inner loop (columns/items)