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 trial
Make Sheep.noise() return the uppercased version of the instance's sound.
from animal import Animal
class Sheep(Animal): sound='growl'
def sound(self): return self.sound()
def noise(self): return self.sound.upper()
I try this adding the noise method to make the self.sound to uppercase but it shows error....is there something missing or I have the wrong order of the code?
Kenneth LoveTreehouse Guest Teacher
Your second task is a bit confused. It's a method that just returns itself because it calls itself (
self.sound() means call the
sound method that belongs to this instance).
You don't need to define a
sound() method, you need to set the
sound attribute. Basically exactly what you did for step 1.
In step 3, you need to rewrite
noise() just like you did. Your code is failing, though, because of how you defined
sound() in step 2.
here is the what i did and its correct from animal import Animal class Sheep(Animal) pass
def init(self): self.sound='meeeeeeew' def noise(self) return self.sound.upper()