Skip to content
CodeKruPro

A child class that overrides a method

Predict the outputEasyPython only
main.py
class Animal:
    def speak(self):
        return "..."

    def intro(self):
        return "I say " + self.speak()

class Dog(Animal):
    def speak(self):
        return "Woof"

for pet in [Animal(), Dog()]:
    print(pet.intro())

Graded by exact match. Spaces at the ends of lines and blank lines at the end do not count.

to answer and keep your progress. Reading is free for everyone.