Python Object-Oriented Python Instant Objects Your first method

Olivia Reyes Carbonell
Olivia Reyes Carbonell
5,113 Points

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!