2. Methods

Functions that belong to an object

A method is a function inside a class. Its first input is self — the object it was called on — so track.play() can use track's own drum and beats.

🎯 0/4 · 🥁 0 solved · 🏅 0

Challenge A:Add def play(self): self.drum(self.beats). Then Track(kick, [1, 5]).play() and Track(snare, [3, 7]).play().

Goal
snare
kick
1234
5678