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 trialluke hammer
25,513 Pointsmental check
I"m must be missing something here. i test this code other places and it seems that the test is not correct can some one tell me what is going on here??
class Student:
def __init__(self,name):
self.name = name
3 Answers
Chase Swanson
Courses Plus Student 8,886 PointsWhen you define a method with parameters you may set default values for them.
For example..
def methodName(foo, bar = "example"):
With this, if you call the method and only pass one parameter, it will set the second parameter to the default value.
You need to do the same thing in this exercise. It wants you to set a default value for name in the dunder init method.
As I mentioned before, your code as it is written is technically correct, but the drill is looking for you to set a default value as well.
Chase Swanson
Courses Plus Student 8,886 PointsYour code is technically fine but the drill wants you to set a default value for name in init. If you do that it should pass.
luke hammer
25,513 PointsI'm sorry I don't understand your answer. aren't I over writing the default init??
kiran kumar
137 Pointsclass Student: def init(self, name="kiran"): self.name = name
luke hammer
25,513 Pointsluke hammer
25,513 Pointsthis is the tasks Override init in Student. Give init a name keyword argument with a default value of your choice. Set self.name equal to the name argument.