Speak¶
Create the class with the following UML. We will be giving the Animal
class an instance method called speak
. The purpose is to simply print out the string "GENERIC ANIMAL SOUND"
.
Starter code¶
class Animal:
def __init__(self, name: str):
self.name = name
# place the instance method here (in the class)
a = Animal("dog")
a.speak() # will raise an AttributeError
# unless you implement it in the class
©2021 Daniel Gallo
This work is licensed under Attribution-NonCommercial-ShareAlike 4.0 International