Python Object-Oriented Python Instant Objects Method Interactivity

Ricardo Franco
Ricardo Franco
Python Development Techdegree Student 12,684 Points

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
200,698 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!

Ricardo Franco
Ricardo Franco
Python Development Techdegree Student 12,684 Points

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