Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Object-Oriented Python (retired) Inheritance Override Inherited Methods

Dwarika Mishra
Dwarika Mishra
1,827 Points

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

What wrong i am doing here that it is showing my code wrong and every time its saying it looks like Task is no longer passing

sheep.py
from animal import Animal

class Sheep(Animal):
      sound ='bark'
    def noise(self):
        return self.sound.upper()

2 Answers

Sean T. Unwin
Sean T. Unwin
28,660 Points

The indentation is too far. Make sure your indents are 2 or 4 spaces and consistant. Ideally a multiple of 4 in the real world. The Challenge editor accepts 2 spaces, where 2 spaces equals 1 tab.

Hanley Chan
Hanley Chan
27,771 Points

Hi, Looks like it's all correct except some indenting errors

from animal import Animal

class Sheep(Animal):
  sound ='bark'

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