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

"Your first method" question (within Tracks>Beginning Python>Object-Oriented Python)

This code outputs "Great job, Michael!" and utilizes a praise method:

class Student:

def __init__ (self, name):
    self.name = name

def praise(self, name):
    print("Great job, {}!".format(name))

m = Student("Michael") m.praise("Michael")

Why am I receiving this error: Bummer: Oh no! You forgot the self argument in your praise method

first_class.py
class Student:

    def __init__ (self, name):
        self.name = name

    def praise(self, name):
        print("Great job, {}!".format(name))


m = Student("Michael")
m.praise("Michael")

1 Answer

Steven Parker
Steven Parker
231,275 Points

The error messages can sometimes be a bit odd when the challenge gets confused by extra code or multiple issues.

But some hints about the issues:

  • the instructions ask only for a "praise" method to be added (no "__init))" override)
  • the reference to "name" in the method needs a "self." prefix
  • the instructions ask for the result string to be _return_ed (not printed)
  • you only need to define the method, you do not need to call it