Knowledge organisersArrays and Records
Table structure rows/cols.
A 2D array is a list of lists, representing rows and columns like a table. Access elements with two indices: grid[row][col].
grid = [[1,2],[3,4],[5,6]]grid[0] is the first rowgrid[0][1] is row 0, column 1for loops to process all elementsgrid = [
[1, 2, 3],
[4, 5, 6]
]
print(grid[0][2]) # 3 (row 0, col 2)
for row in grid:
for item in row:
print(item, end=" ")
print()