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 trialBenjamin Parker
1,752 PointsI don't understand what this code challenge wants me to do
CODING CHALLENGE PROMPT
This class should look familiar!
I need you to add a method name praise. The method should return a positive message about the student which includes the name attribute. As an example, it could say "You're doing a great job, Jacinta!" or "I really like your hair today, Michael!".
Feel free to change the name attribute to your own name, too!
I'm not sure what this challenge is asking me to do exactly. I tried returning a string with the name attribute formatted in and concatenating the attribute as well. Any help would be appreciated. Also would help to know if my code is faulty or why the code it is looking for is better.
class Student:
name = "Ben"
def praise:
return "YOU are doing great {}".format(name)
Benjamin Parker
1,752 PointsIt keeps saying name is not defined... but it is isn't it?
1 Answer
Benjamin Parker
1,752 PointsI figured it out...
I needed to use self.name as the attribute not name.
Benjamin Parker
1,752 PointsBenjamin Parker
1,752 PointsDARN I'm so silly. I forgot to use parenthesis+self parameter....
But it still doesn't work...