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 trialDarrin Spell Jr
Full Stack JavaScript Techdegree Student 10,303 PointsConfused
I am confused. Can someone explain to me what I am doing wrong please.
class RaceCar(color, fuel_remaining):
def __init__(self, color, fuel_remaining, **kawargs):
self.color = red
self.fuel_remaining = guage
for key, value in kwargs.items():
setattr(key, value, **kwargs)
2 Answers
Steven Parker
231,269 PointsYou're getting kind of close, but:
- "RaceCar" doesn't inherit from other classes, so it doesn't need terms in parentheses
- you have "kawargs" (with an extra "a") instead of "kwargs"
- nothing named "red" has been defined .. did you mean "color"?
- nothing named "guage" has been defined ... did you mean "fuel_remaining"?
- the "setattr" function doesn't need a "**kwargs" argument
- but it does need a "self" argument
ursaminor
11,271 PointsYour syntax is wrong. Here are some resources:
Dave StSomeWhere
19,870 PointsDave StSomeWhere
19,870 PointsCheck out the teachers notes on the Method Arguments video and compare it to your code.
Here's 4 things that look wrong - is that what you are asking about?
kwargs
isn't consistentself.color
andself.fuel_remaining
is not being set with the parameter values**kwargs
tosetattr()
? You're already passing the key and value, also don't you needself
in there?