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

Class methods

I am so confused as to why this is not working. I try it on a text editor and it works perfectly fine. Can someone please direct me to another explanation of class's.

first_class.py
class Student:
    name = "Your Name"

    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 grade > 50:
            return self.praise()

adrian = Student()
print(adrian.feedback(55))

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Adrian Diaz! It looks like you're doing really well and you're almost there. You just haven't quite finished the assignment the task set out for you. The task asks you to return self.praise() if the grade was greater than 50, which you did just fine. However, if it's not greater than 50 it should return self.reassurance(). In short, you're missing an else statement in your feedback() method.

Hope this helps! :sparkles:

edited for additional information: Also, you will not need to create an instance of Student yourself or print anything for the purposes of this challenge. :smiley:

Thanks!