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 trial

Python Object-Oriented Python Instant Objects Method Interactivity

class question

I have this query but it's giving me an error. I can't see figure out why.

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)

grade = 0
def feedback(self):
    if self.grade > 50:
        return praise
return reassurance
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)

    grade = 0
    def feedback(self):
        if self.grade > 50:
            return praise
        return reassurance

2 Answers

Jeff McDivitt
Jeff McDivitt
23,970 Points

Hi Jinny -

There are a few things wrong here, the first being that the method takes an argument (grade) which you do not have. Also both praise and reassurance are functions so you need to call them

 def feedback(self,grade):
        if grade > 50:
            return self.praise()
        return self.reassurance()

Man, that's so confusing... haha thank you!!

I have submitted this answer but I am still getting an error. I've looked at other resources and I can't find a reason why this is wrong.

class Student: name = "Jinny"

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()
    return self.reassurance()