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 trialYingchao Lin
3,714 PointsI created the __init__(self, arg), and assign arg to self.name, but always resulted in failure...don't really know why..
i probably misunderstood the meaning of the question. But on my python terminal, it compiles and runs just fine. Here's what I did:
def init(self, arg): self.name = arg
Is there anything wrong with this approach?
1 Answer
boog690
8,987 PointsIt asks for you to give name a default value of your choice. That would look something like this:
class Student():
def __init__(self, name="My name goes here"):
self.name = name
Yingchao Lin
3,714 PointsYingchao Lin
3,714 Pointsgot it. Thank you :)