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

shekhar bhardwaj
seal-mask
.a{fill-rule:evenodd;}techdegree
shekhar bhardwaj
Full Stack JavaScript Techdegree Student 12,373 Points

What am I missing here ?

getting all sorts of different error, like can't find student or missing the self from praise function.

first_class.py
class Student:

    name = "Jacinta"

    def praise(self):
        if self.name == "Jacinta":
            return "You're doing a great job, Jacinta!"
        elif self.name == "Michael":
            return "I really like your hair today, Michael!"
    #student = Student()
    #self.name = "Jacinta"
    self.praise()

1 Answer

nicole lumpkin
PLUS
nicole lumpkin
Courses Plus Student 5,328 Points

Hi Shekhar!

spoiler at the end of this post

I think the main problem with your code is that you are totally misinterpreting the question :) Forget about the names Jacinta and Michael. All you need to do in this challenge is create a method within the Student class called praise. The only argument it takes is self. From there simply return any string and use .format() to insert the instance's name attribute!

class Student:
    name = "Nicole"

    def praise(self):
        return "Good job {}!".format(self.name)