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

Python

help

Animal.noise() returns self.sound.lower(). Make Sheep.noise() return the uppercased version of the instance's sound.

my code:

from animal import Animal

class Sheep(Animal):
  sound = 'squak'

  def animal_noise(self):
    return self.sound.lower()
  def sheep_noise(self):
    return self.sound.upper()urn self.sound.upper()

http://teamtreehouse.com/library/override-inherited-methods

2 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

You don't need to make animal_noise() and sheep_noise(). Those will never be checked or called, because the challenge is about overriding Sheep.noise(). That means you have to override the noise() method in the Sheep class.

Hi Lyric,

It looks like your only issue is that you didn't indent the noise method so that it is within the class. The return should have 2 levels of indent so that it remains inside the noise method.

i did it and it still didnt work

It looks like you updated the code in your question since I've answered.

The other code that you had was correct except for the indentation levels.

The method name should be noise not animal_noise.

This was your original code that you posted but with the proper indentation levels:

from animal import Animal

class Sheep(Animal):
  sound = 'squak'

  def noise(self):
    return self.sound.upper()