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 trialRicardo Franco
Data Analysis Techdegree Student 16,258 PointsStuck on coding challenge
I know I am close but the challenge is telling me that I am getting an "ExceptionError: the 'praise' method is not defined". I tried calling the feedback method and I am still not making any progress. Please assist at your convenience. Thank you in advance.
class Student:
name = "Ricardo"
grade = 60
def praise(self):
return "You inspire me, {}".format(self.name)
def reassurance(self):
return "Chin up, {}. You'll get it next time!".format(self.name)
def feedback(self, grade):
if self.grade > 50:
praise()
else:
reassurance()
1 Answer
Steven Parker
231,248 PointsYou're close, but components of the same class should be referenced with a "self.
" prefix. Try calling "self.praise()
".
And remember that the challenge wants you to return the result of calling the other method!
Ricardo Franco
Data Analysis Techdegree Student 16,258 PointsRicardo Franco
Data Analysis Techdegree Student 16,258 PointsThanks Steven...I have found that knowing when to incorporate "self" takes some getting used to when working with classes. Thanks for your time.