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 trialTara Edwards
6,521 PointsOf course Task 1 is no longer passing, now do I keep that task while using keyword arguments?
I feel like I am assigning the value of name twice. If I keep it to the init arguments, Task 1 no longer passes. If I keep task 1, I get error messages. Am I missing something? Commenting out the original assignment does not work.
class Student:
name = "Tara"
def __init__(self, **kwargs):
self.name = kwargs.get(name, "Tara")
2 Answers
Brian Fuller
6,699 PointsThe argument you pass to kwargs.get() should just be the key of the dictionary entry that you want to extract.
Tara Edwards
6,521 PointsOK, I have looked at other posts on the same subject (I guess I had better luck looking for init than anything else).
class Student:
name = 'Tara'
def __init__(name='Joe'):
self.name = name
Tara Edwards
6,521 PointsTara Edwards
6,521 PointsWell, I made some changes. Thing is, the instructions said "override the init". Do I declare init twice? If so, why does it make Task 1 not work?