Dan Barnett1,619 Points
racecar.py - Blocked on task 1 [SOLVED]
Here is the task that I have been given:
First, create a class named RaceCar. In the init for the class, take arguments for color and fuel_remaining. Be sure to set these as attributes on the instance.
Also, use setattr to take any other keyword arguments that come in.
Ive attached my code, but i am getting an error regarding unassigned attributes. Any ideas?
class RaceCar: def __init__(self, color, fuel_remaining, **kwargs): self.color = color self.fuel_remaining = fuel_remaining for key, value in kwargs.item(): setattr(self, key, value)