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

Grant Murphy
Grant Murphy
10,072 Points

Code works in compiler but not code challenge. Getting OH no you forgot to add self as an argument.

As the title suggest I am reeving this error and I have no idea why. The code works in the Work-space here it is

class Student: name = "Your Name"

def praise(self):
    return print("This shold be working WTF!!!!!!!!!!!!!!!!!!!!!!!!! {}".format(self.name))

grant = Student()
grant.name = "Grant" Student.praise(grant)

I also tried grant.praise() and that will not work either.

first_class.py
class Student:
    name = "Your Name"

    def praise(self):
        return print("This shold be working WTF!!!!!!!!!!!!!!!!!!!!!!!!! {}".format(self))

grant = Student()
grant.name = "Grant"
Student.praise(grant)

2 Answers

The print function returns None so your praise method returns None. Remove the print function.

If you want to test try:

grant = Student()
grant.name = "Grant"
print(grant.praise())

Although your test code should also be removed from the challenge.

You will also want to use self.name like in your first code. Your second code only has self.

Grant Murphy
Grant Murphy
10,072 Points

Thank you, yes it was the print function. Although I wonder why it would compile else ware??

So I just need to get rid of the print that's it?