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

My code seems to work everywhere except in this code challenge. Is my answer wrong?

I keep getting the error that says I forgot the self parameter in my praise method. I'm not sure why. I have self as a parameter in the praise method. Is my code wrong or is the code challenge wrong?

first_class.py
class Student:
    name = "Will"

    def praise(self):
        print(f"Good job, {self.name}!")

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, william coleman ! You're doing terrific and I love that you're using f-strings here. But yes, your code is currently incorrect, but not by much. It comes down to an interpretation of the instructions. The challenge asks you to return the string, but you're printing the string. It's expecting to get back a value, but not getting back anything at all. Simply changing your print statement to a return statement causes this to pass.

Hope this helps! :sparkles:

Thanks! Very helpful!