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 trialLaone Moshana
4,082 Pointspython oop with kenneth
am failing to understand oop ,from the first two videos i have watched am totally lost,please helf
class Student:
name = "Your Name"
def praise(self) :
return 'well done'.self
def_str_(self):
return self.name
1 Answer
Steven Parker
231,269 PointsHere's a few hints:
- nothing named "
def_str_
" has been defined, and it's not valid definition syntax - the instructions only ask for a "praise" method, nothing else will be needed
- a string has no "self" attribute
- you can use concatenation ("+" operator) to build up a string using a variable
- the syntax for a concatenated message might look like
'well done ' + self.name