Lists of lists
A grid is a list of rows, and each row is a list. grid[1][3] means row 1, column 3 — both counting from 0. That's exactly how a drum machine's grid of buttons works.
Lesson 2: numbers in a grid become hits.
drums = [hihat, snare]
grid = [[2, 2, 2, 2], [0, 0, 1, 0]]
for r in range(2):
for c in range(4):
if grid[r][c] > 0:
drums[r](c + 1, grid[r][c])Challenge A:grid = [[1, 0, 1, 0]]. Loop c over range(4) and play the kick on c + 1 when grid[0][c] == 1.