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 trialCarina De Jager
1,779 PointsWon't change to uppercase
Hey guys. Posted this same question in the early afternoon yesterday and never got an answer... Any insights as to why my Grrr!!! isn't coming back in uppercase?
from animal import Animal
class Sheep(Animal):
pass
sound = 'Grrr!!!'
def __str__(self):
self.sheep.noise = self.sound.upper()
2 Answers
Chase Marchione
155,055 PointsHi Carina,
Instead of a str method, let's create a method named noise, and have it return the uppercase value of the instance's sound. That way, noise will be set to that value (the uppercase value of self.sound.)
from animal import Animal
class Sheep(Animal):
pass
sound = 'Grrr!!!'
def noise(self):
return self.sound.upper()
Hope this helps!
Carina De Jager
1,779 PointsYES!!! Thank you! Was starting to go a bit bonkers. Haha