Piano plays middle C
Input
get_instrument_sound('piano', 'C4')
Output
Piano plays C4
The Piano class implements play; the factory function instantiates Piano and calls play with note 'C4'.
Full lesson preview
Learn to define an abstract base class (ABC) and ensure subclasses implement required methods using abc.ABC and @abstractmethod.
Problem statement
Task
Examples
Input
get_instrument_sound('piano', 'C4')
Output
Piano plays C4
The Piano class implements play; the factory function instantiates Piano and calls play with note 'C4'.
Input format
Output format
Constraints
Samples
Input
get_instrument_sound('drum', 'beat')
Output
Drum plays beat
Drum implements play and returns the formatted string.