Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Object-Oriented Python Instant Objects Your first method

Adam Del Conte
Adam Del Conte
2,669 Points

I must have forgotten another version of my(self)? Trouble with my first method :\

Hello all. I have worked through this a few times.

The error result i'm receiving is "Bummer: Oh no! You forgot the self argument in your praise method"

Initially I was not using def appropriately, and for a while I got stuck on calling name instead of Student.name().

I feel as though I corrected those issues appropriately, but now I'm not sure if I have created new issues along the way:

Is the problem trying to return a print statement?

Should I be trying to return (f"Great work {}!".format(Student.name(self)))

I thought adding 'self' into Class.attribute() was redundant.

Feeling a bit lost.

Thanks :)

first_class.py
class Student:
    name = "Adam"

    def praise(self):
        return print("Great job", Student.name(), "!")

1 Answer

Adam Del Conte
Adam Del Conte
2,669 Points

Aaaaaaaand I found the answers in posts from others that I missed before.

So no need to print, got it.

And use self.name to call name from outside the method but within the class.

Is that the right way to think about it?

Still a little hazy on when to use and not use self, but as we're jus scratching the surface I'm sure it will become more clear as we go.