← 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

1grid = [
2[1, 2, 3],
3[4, 5, 6],
4[7, 8, 9]
5]
7print(grid[0])
8print(grid[0][1])
9print(grid[2][0])
Ready

What's Happening

Press Play or Step to begin

Output

No output yet

Legend

Outer loop (rows)
Inner loop (columns/items)