Starting empty and appending
A list can start empty — beats = [] — and grow as a loop runs, one .append() at a time. Then one command plays the whole thing.
Lesson 1: one loop sorts every beat into kicks or snares.
kicks = []
snares = []
for b in range(1, 9):
if b % 2 == 1:
kicks.append(b)
else:
snares.append(b)
kick(kicks)
snare(snares)Challenge A:Start with beats = []. Loop b through range(1, 9, 2), appending each b, then play kick(beats).