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

This class should look familiar! I need you to add a method name praise. The method should return a positive message

Where am i going wrong here

class Student:
    name = "Ernest"

    def praise(self):
    return ("You're doing a great job, {}!".format(self.name))

2 Answers

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

Just indent the return keyword inside the praise function.

Python is very strict about indentation. :-)

Anytime that you have a class, method, or function you need to indent as Jonathan said. 4 spaces or 1 tab is the best practice for pep8. Check it out here for more info: https://www.python.org/dev/peps/pep-0008/

An example looks like:

class ExampleClass:
    name = "Nathan"

    def exampleFunction(self):
        return self.name