9/11. Inheritance


#1



What did I do in a wrong way? Thank you in advance.

https://www.codecademy.com/courses/python-intermediate-en-egNXj/1/3?curriculum_id=4f89dab3d788890003000096


Oops, try again. You should define init() for both Car and ElectricCar.
Traceback (most recent call last):
File "python", line 23, in
TypeError: init() takes exactly 4 arguments (5 given)


Next task.


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

class ElectricCar(Car):
    def __int__(self, model, color, mpg, battery_type):
        self.model = model
        self.color = color
        self.mpg   = mpg   
        self.battery_type = battery_type
my_car = ElectricCar("DeLorean", "silver", 88, "molten salt")
print my_car.condition

my_car.drive_car()
print my_car.condition


#2

in ElectricCar you misspelled init


#3

Ohhh how I could be so stupid. Thank you very much.


#4