Python Object-Oriented Python Instant Objects Your first method

David H
PLUS
David H
Courses Plus Student 5,467 Points

I am trying to add a method named "praise" a class named "Student" and return a positive message but its not working.

I feel like I am doing everything this challenge is asking me to do, but I can't seem to quite get it done the way I am suppose to and I don't know what the problem is. Everytime I think I got it down pack after doing tons of research about classes and methods in python I still can't seem to quite understand it very well. It gives me this message "Didn't find the name in the praise message. Be sure to use the instance attribute! " Someone please help! this is my code.

class Student:
    name = "Your Name"

    def praise(self):
        return " Your doing great " + name
first_class.py
class Student:
    name = "Your Name"

    def praise(self):
        return  " Your doing great " + name

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 59,682 Points

You are so close! As written, the variable name is not defined within the method. To get to the value of the attribute attached to the instance, use self.name.

Post back if you need more help. Good Luck!!