RockBlocks

6. zip and enumerate

Walking lists together

zip(beats, hits) pairs two lists up item by item. enumerate(pattern) pairs each item with its position. Unpack the pairs right in the loop: for b, h in zip(beats, hits):

🎯 0/4 · 🥁 0 solved · 🏅 0

Challenge A:beats = [1, 2, 3, 4] and hits = [1, 2, 1, 4]. Loop i over range(4), playing snare(beats[i], hits[i]).

Goal
snare
1234