class Car(object): condition = "new" # member variables: Saved in this class only def __init__(self, model, color, mpg): self.model = model self.color = color self.mpg = mpg def display_car(self): tmp = "This is a " + str(color) + " " + str(model) + " with " + str(mpg) + " MPG." return tmp def drive_car(self): self.condition = "used" class ElectricCar (Car): def __init__(self,model, color, mpg,battery_type): super().__init__(model,color,mpg) self.battery_type = battery_type model = "DeLorean" color = "silver" mpg = 88 my_car = ElectricCar(model, color, mpg, "molten salt")
Oops, try again. my_car does not appear to be an instance of ElectricCar
I don't know why is it. Please help me..
Replace this line with your code.