class Car(object):
condition = "new"
def init(self, model, color, mpg):
self.model = model
self.color = color
self.mpg = mpg
def display_car(self):
print "This is a %s %s with %s MPG."%(self.color,self.model,self.mpg)
def drive_car(self):
class ElectricCar(Car):
super(ElectricCar, self).init(model, color, mpg)

my_car= Car("toyota","blue",80)
my_car = ElectricCar("molten salt")


What is your question?


what have i done wrong?
what i need to change/add? and why..


your ElectricCar should have init method to initialize all instance variable (super() + self.battery_type)


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.