Question OOP-POLY-0034
EasyWhat is the output of this code?
class Cat:
def speak(self):
return "Meow"
class Dog:
def speak(self):
return "Woof"
for a in [Cat(), Dog()]:
print(a.speak(), end=" ")
- A.
Meow Meow
- B.
Error
- C.
Meow Woof
- D.
Woof Meow
Sign up free to see the answer and a step-by-step explanation.