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 trialAshley Keeling
11,476 PointsI don't know why this method isn't working
I have tried adding self and the methods but I wont work and it says try again
class Student:
name = "Ashley"
def praise(self):
return "You inspire me, {}".format(self.name)
def reassurance(self):
return "Chin up, {}. You'll get it next time!".format(self.name)
def feedback(grade,self):
if grade>50:
return praise()
elif grade=<50:
return reassurance()
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, Ashley! First, you're going to need to adjust the order in which you send in the arguments. You should send in self
and then grade
. Secondly, and most importantly, you have a syntax error. You meant to type <=
, but you typed =>
in your elif
. Third, you should be returning the results of the methods when called on the self
object.
I think you can get it with these hints, but let me know if you're still stuck!
Ashley Keeling
11,476 PointsAshley Keeling
11,476 PointsI have some the first and second step but I am not sure about the third so far I have put(do I need self in the praise and recurrence ):
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherHi again! Yes, you will need
self.praise()
for example. You need to tell it to call that method on the current instance of the object and we do that by using the self keyword.Ashley Keeling
11,476 PointsAshley Keeling
11,476 Pointsthanks for the help I didn't know I had to e.g. self. Praise()