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

raul blazquez
raul blazquez
95 Points

I get the following message: Didn't find the name in the praise message. Be sure to use the instance attribute!

I have executed it in a notebook and it actually works.

first_class.py
class Student:
    name = "Raul"

    def praise(self):
        return "Good job, %s" % Student.name


Raul = Student()

Student.praise(Raul)

1 Answer

Thomas Hooper
Thomas Hooper
15,557 Points

Hey! If I'm reading this correctly, you need a class with a praise method that returns a string with the instantiated name to the class. Try this, and see if your challenge passes.

class Student:
    def __init__(self, name):
        self.name = name
    def praise(self):
        return "Good job, %s" % (self.name)



Raul = Student("Raul")

print(Raul.praise())

Moderator Edit: Moved response from Comment section to Answers