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 trialDylan Messimer
2,114 PointsI don't know what I am supposed to be typing.. I need help understanding this assessment
Override init in Student so name can be set when an instance is created with name="some name". You might want to unpack a dict.
I have no clue what to do here.. any help is appreciated
3 Answers
John Steer-Fowler
Courses Plus Student 11,734 PointsHey Dylan Messimer,
Would you be able to post the code you have written so far? We can then take a look for you and see how we can help.
Please refer to the Markdown Cheatsheet below the answer textbox before posting to ensure you post your code correctly.
If you are struggling to paste your code, try putting three backticks ``` on the line before and the line after your code.
Hannah Taylor
2,407 PointsHi, I'm stuck in the same place. I wrote this for task 1:
class Student:
name = 'Hannah'
Then changed it to this for task 2:
class Student:
def __init__(self, **kwargs):
self.name = kwargs.get(name, 'Hannah')
And first I was getting a Bummer that said "Now task 1 isn't passing", so I tried changing a bunch of things then put it back to this, and now I'm getting "Bummer, did you define 'Student'?
Not sure what to do for this, is it something to do with overriding init?
Thanks, Hannah
P.S. Can't get the second code block to show up properly, even though I did it same as the first :/ Sorry
Gard Mikael Fjeldavli
19,416 PointsYou might experience problems if your indentation is not correct. Hannah above has got the right idea, but if the indentation is not correct the code wont compile. Here is how I passed:
class Student:
name = "Gard"
def __init__(self, **kwargs):
self.name = kwargs.get("name", "some name")
James Gill
Courses Plus Student 34,936 PointsJames Gill
Courses Plus Student 34,936 PointsJohn,
It's good to see code, but Dylan's looking for an explanation of the challenge. It doesn't sound like he's written any code.