Python Object-Oriented Python Instant Objects Method Interactivity

I really don't understand 'self'

I'm not getting any useful error, it just says 'bummer, try again' and I don't know what I'm doing wrong.

(For those in charge of course content, please rework this section (self) and probably also the one before it (dicts). The videos do not adequately explain what's happening, and the challenges ask for things the videos didn't cover. I should not be having to ask the community for help on every single challenge, and the fact that I am both slows down my learning and points to insufficiency in the material.)

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

    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 is > 50: 
            return praise(self) 
        elif grade is <= 50: 
            return reassurance(self) 

Update: I've rewatched the video at least 3 times and reworked the code in every permutation I can think of. I have no idea why it's not working. (I'm seriously about to quit this course, these videos do not adequately prepare you for the code challenges. Add more chances in the video for the student to try and code, then explain the correct answer. Make the errors actually useful. Add hints after 5 challenge attempts or something. Being stuck on one question for literal hours because the video didn't properly teach me how to code this, and having to wait and rely on community posts is infuriating.)

```class Student: name = "Your Name" grade = 79

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

2 Answers

Brigitte Schuster
Brigitte Schuster
23,688 Points

In the feedback method, you need to call the instance methods praise() or reassurance(), this is done by writing self.praise() and self.reassurance()

Methods are always called with this syntax <instance name>. <class method name>()

Readability note: The ... elif ... statement adds a redundant test, a simple else: does the job.

Brigitte Schuster
Brigitte Schuster
23,688 Points

Almost there! The method feedback takes two arguments self and grade so instead of using a "." you should write feedback(self, grade)

grade is not an attribute of the class Student, it is the second argument of the method feedback()

Thank you for your quick answer! That makes sense, that I'm passing two arguments. Unfortunately I'm still getting a 'bummer, try again' error :(