← Back to Exercises
🏗️

Classes & Objects • Exercise 112 of 112

Animal Family

Medium⭐ 35 XP🏆 Your XP: 0

🎯 Your Mission

Create a class Animal with a name and a method eat() that prints the name and "is eating". Then create a class Dog that inherits from Animal and adds a method bark() that prints "Woof!". Make a Dog named Rocky and call eat() and bark().

🐍 main.pyTab = 4 spaces • Ctrl+Enter = Run
▶ Output
Press ▶ Run to see what your code does!