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 trialSabine Lazuhina
2,334 PointsI can't add the new method 'feedback'
I am doing this class method creation excercise but for some reason it does not work ..
class Student():
name = "Sabine"
grade = grade
def praise(self, name):
return "You inspire me, {}".format(self.name)
def reassurance(self, name):
return "Chin up, {}. You'll get it next time!".format(self.name)
def feedback(self, name, grade):
self.grade = int.input("{}, Your grade is:> ".format(self.name))
if self.grade > 50:
return Student.praise
else:
return Student.reasurance
1 Answer
Niquan Colclough
3,029 Pointsclass Student(): name = "Sabine"
grade = grade You will not need this line
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)
You do not need to add "name" to the method arguments.
def feedback(self, grade):
self.grade = int.input("{}, Your grade is:> ".format(self.name)) You will not need this line either, I also took the name argument out.
I switch out self.grade with grade and took the else statement out. Make sure your indentions are correct when doing the code challenge over.
if grade > 50:
return self.praise()
return self.reassurance()
Steven Parker
231,275 PointsSteven Parker
231,275 PointsJust wondering ... where did you hear/read/see the term "call signs"?
I associate that term with radio communications, as described in Wikipedia.
Niquan Colclough
3,029 PointsNiquan Colclough
3,029 PointsThe parentheses indicate that you want to call the method. 'praise()' returns the value of the method applied to the argument. If you simply say 'praise', then it returns a method, not the value you get when the method is applied. That is why I call them call signs. It may not be correct terms, but it is my way of putting it in my own words.
Niquan Colclough
3,029 PointsNiquan Colclough
3,029 PointsCool, I'll try to remember that next time I use the phase in an open forum