Make and speak as a dog
Input
create_animal('dog', 'Rex').speak()
Output
Rex says woof
create_animal returns a Dog instance. speak() returns a string using the instance name and the dog's sound.
Full lesson preview
Define an abstract base class and implement multiple concrete subclasses that follow the required interface.
Problem statement
Task
Examples
Input
create_animal('dog', 'Rex').speak()
Output
Rex says woof
create_animal returns a Dog instance. speak() returns a string using the instance name and the dog's sound.
Input format
Output format
Constraints
Samples
Input
create_animal('bird', 'Tweety').speak()
Output
Tweety says tweet
Birds say 'tweet' in this exercise.