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 have no clue how to do this

Cant see what i have to do

first_class.py
class Student:
    def praise(self.name):nb
        name = "Olivia"v
        return self.name("You're doing a great job, {}".format(self.n ame)) 

1 Answer

Hi Olivia Reyes Carbonell You are pretty close here!

First, we are wanting to set the name property right under the class, not the method. For example:

class Book:
    title = "The Lord of The Rings"
    author = "J.R.R. Tolkien"

Then we can add our method under the properties within the class:

    def review(self):
        return "The book {}, is an excellent book that I would recommend to anyone who loves to read fantasy and adventure books!".format(self.title) 

Calling the review method would then return the string:

The book The Lord of The Rings, is an excellent book that I would recommend to anyone who loves to read fantasy and adventure books!

Hopefully, this example helps give you an idea of the formatting! :D Happy coding!