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 Object-Oriented Python (retired) Inheritance Override Inherited Methods

Won't change to uppercase

It's returning the sound but it's still all in lowercase. Why???

sheep.py
from animal import Animal
class Sheep(Animal):
  pass

  def __init__(self, **kwargs):
    self.sound = kwargs.get('sheep', 'Grrrrr!!!')

  def __str__(self):
    self.Sheep.noise = self.sound.upper()

1 Answer

Max Hirsh
Max Hirsh
16,773 Points

So for this challenge, it looks like it is asking you to redefine certain attributes for Sheep that it might inherit from Animal. To do that you don't have to run an init(self) or str(self). Also remember that the "pass" argument is for classes/functions that are blank, so you should delete it after you add anything. Also, keep in mind that methods usually "return" variables after they perform their operations. Let me know if that helps!