I don't understand how the code on line 17 works #9



No error messages

just want to know what it does,and how it works.

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"
my_car = Car("DeLorean", "silver", 88)
print my_car.condition
print my_car.condition
class ElectricCar(Car):
    def __init__(self, model, color, mpg, battery_type):
        Car.__init__(self, model, color, mpg)
        self.battery_type = battery_type
my_car = ElectricCar("toyota", "blue", 44, "molten salt")


You could use

my_car = ElectricCar("toyota", "blue", 44, "molten salt")
print my_car.condition
print my_car.display_car()
print my_car.battery_type
print("=my_car= constructed with {0}\n".format(type(my_car).__name__))
print("Who is the parent-Class of the constructor {0}".format(
print my_car.__class__.__bases__
print "==="
print my_car.drive_car.__class__
print dir(my_car)