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 trialGrant Murphy
10,072 PointsCode 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.
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
KRIS NIKOLAISEN
54,971 PointsThe 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
10,072 PointsThank you, yes it was the print function. Although I wonder why it would compile else ware??
Keegan Swanson
1,339 PointsSo I just need to get rid of the print that's it?