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 trialHarold Thompson
18,157 PointsI am stuck on the first challenge of Object-Oriented Python.
What am I doing wrong?
class Student:
self.name = 'Bob'
def praise (self):
return ('Your doing a great job {self.name}'.format(self.name))
1 Answer
Christian Beckett
11,123 PointsHi Harold. here's what your supposed to have. if you have questions feel free to consult me
class Student:
name = "Fireball"
def praise (self):
return "{} Your doing a great job!!".format(self.name)
you see you don't have to make the variable self.name the variable becomes self.name when you create it underneath the argument of self. you also don't have to put self.name in the text you normally just implement it in this way Harold Thompson
Christian Beckett
11,123 PointsChristian Beckett
11,123 Pointsalso when you are using return you normally don't need parenthesis. unless its for a add on such as .format, .append. etc.
Harold Thompson
18,157 PointsHarold Thompson
18,157 PointsThanks Christian Beckett and I appreciate the details with the answer. It worked.
Christian Beckett
11,123 PointsChristian Beckett
11,123 PointsNo Problem my dude.