how do i print everything: model color mpg n battery type?

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 " +self.color+" "+self.model+" with "+str(self.mpg)+" MPG."
    def drive_car(self):
        return self.condition
class ElectricCar(Car):
    def __init__(self, model, color, mpg, battery_type):
        super(ElectricCar,self).__init__(model, color, mpg)
my_car = ElectricCar("DeLorean", "silver", 88,"molten salt")
print my_car


Hi @yang96,

You can override the display_car method by writing a new version of it for the ElectricCar class. Within that method, add the information about self.battery_type to the statement that produces the output. Try it out, and post it if you would like us to look at it.


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