Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMUZ140348 Sympathy Makururu
10,209 PointsMake a new class named Sheep that inherits from Animal. The Animal class is in animal.py. Remember, you can use pass to
Make a new class named Sheep that inherits from Animal. The Animal class is in animal.py. Remember, you can use pass to make empty classes.
import animal (animal.py): class Sheep(Animal), pass
MUZ140348 Sympathy Makururu
10,209 PointsThanks but still Facing Challenges. Any Help.
Ngonidzashe Zvomarima
2,373 Pointsthat one worked for me
4 Answers
Vittorio Somaschini
33,371 PointsHello!
There is a bit of confusion in your code I believe. Let's tackle it step by step:
1) the import statement >> from the file animal.py we want to import the class Animal, so:
from animal import Animal
2) the class definition: your code is close but after class Sheep(Animal) you need to use ":" instead of the comma you used. It will look like this:
class Sheep(Animal):
pass
This should work fine.
Vittorio
MUZ140348 Sympathy Makururu
10,209 PointsHi, Vittorio.
Thank you for the help. It has passed:
from animal import Animal class Sheep(Animal): pass
Casey Huckel
Courses Plus Student 4,257 Pointsfrom animal import Animal class Sheep(Animal): Pass
Didn't work for me. I got "Pass" is not defined
Ali Yahya
4,815 Pointspass
is lowercase
Ngonidzashe Zvomarima
2,373 Pointsfrom animal import Animal class Sheep(Animal): pass
veggie mustache
9,990 Pointsveggie mustache
9,990 PointsI think you're really close. For the import, I believe it should look like from animal (py file) import Animal (class) for the class creation, you are maybe just off by a :