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!
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 trial

Leila Hardy
5,601 PointsHelp! I am working on the inheritance badge in Python and I am really stuck on the last code challenge.
Here is my code:
import animal
class Sheep(Animal):
I know that it's wrong, but I'm not sure why. Any pointers?

Leila Hardy
5,601 PointsI am still getting this error:
Bummer! SyntaxError: class Sheep(Animal):
My code now is this:
from animal import Animal
class Sheep(Animal):
Thank you for your help!
3 Answers

shibashis
8,989 PointsYou also need to add 'pass' in third line, as suggested in the code challenge. Or you can define a class variable. You need a line of code there.

Leila Hardy
5,601 PointsYay! Thank you for your help! I have gotten through the first and second tasks, but have one last question about the third task. The question is: "Animal.noise() returns self.sound.lower(). Make Sheep.noise() return the uppercased version of the instance's sound" Here is my code:
from animal import Animal class Sheep(Animal): pass sound = 'baa' def Sheep.noise(): return sound.upper()
I am getting the error: 'Oops! It looks like Task 1 is no longer passing.' What does this mean, and what do I need to fix?

Leila Hardy
5,601 Pointssorry, Markdown is not working at all for me

shibashis
8,989 PointsYou need to remove 'pass' once you write actual code. It is supposed to be a place holder till you write actual code.
Also the sound is instance variable, so, it should be: return self.sound.upper()
Also you cant write Sheep.noise, the name of method should be noise (hence def noise())
Not sure why previous task is failing.

Leila Hardy
5,601 PointsUpdate: I figured out the code challenge; here is my code:
from animal import Animal
class Sheep(Animal):
sound = 'baa'
def noise(self):
return self.sound.upper()

shibashis
8,989 PointsCool. Hope I nudged you towards right direction. Did not want to post solution. :)
shibashis
8,989 Pointsshibashis
8,989 PointsYou imported animal module not the Animal class. You should use:
from animal import Animal