You are on page 1of 4

2D Lists

2D Lists

- Nested Lists (Lists within lists)

- Can be represented like a grid

- In the example, arr is the 2D list


Example

row\colu
mn 0 1 2

0 1 2 3

1 2 4 6

2 1 3 5
Accessing 2D List

row\column 0 1 2

- Each element in the 2D list is 0 arr[0][0] arr[0][1] arr[0][2]


represented as:
- arr [row][column]
1 arr[1][0] arr[1][1] arr[1][2]

2 arr[2][0] arr[2][1] arr[2][2]

You might also like