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 trialShawndee Boyd
6,002 PointsChallenge 3 of 3: I am thinking that this code would return sound.upper but obviously I am wrong. Can someone help me?
from animal import Animal
class Sheep(Animal):
sound = 'squak'
def noise(Animal):
self.sound()
def noise(Sheep):
return self.sound.upper()
6 Answers
David Bouchare
9,224 PointsHey,
so like Petros mentioned above, you shouldn't have Sheep as a second argument of your noise method. Remove it and it should work (Sheep is a class, not an argument of a method).
from animal import Animal
class Sheep(Animal):
sound = 'squak'
def noise(self):
return self.sound.upper()
Petros Sordinas
16,181 PointsHi Shawndee,
Yes you should return sound.upper(), however you have some mistakes in your code:
- You don't need to define noise(Animal)
- You need to define noise in Sheep and pass (self) in the method arguments and then return self.upper()
David Bouchare
9,224 PointsAlso, if you could please format your code, that would greatly help. Using the Markdown Cheatsheet below for instance.
Shawndee Boyd
6,002 Points'''from animal import Animal
class Sheep(Animal): sound = "Squak"
def noise(self, Sheep): return self.sound.upper()'''
This is the code that I have but this is not working either. I am obviously misinterpreting something.
Shawndee Boyd
6,002 PointsAlso, sorry about the post. I forgot the markdown.
Shawndee Boyd
6,002 PointsThanks David and Petros!!! I got it!