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 trialIngrid Matthews
1,465 Pointsusing "self"
I have tried about a million permutations of this. I would appreciate help with what's wrong with my code!
class Student:
name = "Ingrid"
def praise(self):
praise_message = ("Great job, {}!".format(name))
return(praise_message)
return self.praise
1 Answer
Steven Parker
231,268 PointsYou're close, but I see three issues:
- the "class" line should not be indented
- the reference to "name" in the "praise" method needs a "
self.
" prefix - the last line with "return" on it is not part of the method and is not needed
Ingrid Matthews
1,465 PointsIngrid Matthews
1,465 PointsThank you so much Steven, but I may have misunderstood you. Tried this (below), and failed again:
class Student: name = "Ingrid"
Steven Parker
231,268 PointsSteven Parker
231,268 PointsThe first "return" was an important part of the method and should stay, the last one is the one to remove.