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 Your first method

Ricardo Franco
seal-mask
.a{fill-rule:evenodd;}techdegree
Ricardo Franco
Data Analysis Techdegree Student 16,258 Points

Stuck trying to figure out the code challenge

I am not completely clear as to what needs to be accomplished here to complete the code challenge. I even included "name" as a second parameter in the praise method to see if that would solve the problem but I am not having any luck. Thank you, in advance, for your time and assistance.

first_class.py
class Student:
    name = "Ricardo"

    def praise(self):
        if self.name:
            return print("I really like your hair today, {}!".format(self))

Student.praise()

2 Answers

Mark Sebeck
MOD
Mark Sebeck
Treehouse Moderator 38,304 Points

In your return you need self.name. You just have self. You can delete the if statement and the Student.praise(). Also the return doesn't need the print statement. Just return the string.

Let me know if you need more help

Ricardo Franco
seal-mask
.a{fill-rule:evenodd;}techdegree
Ricardo Franco
Data Analysis Techdegree Student 16,258 Points

I might need your help on the next challenge. I might not be fully understanding the directions quite yet on these challenges.