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

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

Mel Rumsey
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Mel Rumsey
Treehouse Staff

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!