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 trialDavid H
Courses Plus Student 5,467 PointsI 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
class Student:
name = "Your Name"
def praise(self):
return " Your doing great " + name
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsYou 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!!