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 Instant Objects Method Interactivity

Stuck 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.

first_class.py
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
Steven Parker
208,479 Points

You'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!

Thanks Steven...I have found that knowing when to incorporate "self" takes some getting used to when working with classes. Thanks for your time.