9. Inheritance (Car/ElectricCar classes)
I figured out how to make the code work, but in doing so it made me not understand the point of Inheritance - This will make more sense when you look at the code...
I have commented out the lines I added for which the program needed to work. I figured since I was using inheritance, I wouldn't need to use those lines of code. What is the point of Inheritance if you have to basically add in everything it inherits anyways, why not just make a whole separate method?
Replace this line with your code. class Car(object): condition = "new" def __init__(self, model, color, mpg): self.model = model self.color = color self.mpg = mpg def display_car(self): return "This is a %s %s with %s MPG" % (self.color, self.model, self.mpg) def drive_car(self): self.condition = "used" class ElectricCar(Car): def __init__(self, model, color, mpg, battery_type): self.battery_type = battery_type ''' self.model = model self.color = color self.mpg = mpg ''' my_car = Car("DeLorean", "silver", 88) my_car = ElectricCar("Volvo", "black", 30, "molten salt") print my_car.condition my_car.drive_car() print my_car.condition