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

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 :)

class Student:
    name = "Adam"

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

1 Answer

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.