9.Inheritance can't figure out what is wrong


#1



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


Getting following error:
Oops, try again. my_car does not appear to be an instance of ElectricCar.

and

Traceback (most recent call last):
File "python", line 26, in
TypeError: init() takes exactly 4 arguments (5 given)


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
my_car.drive_car()
print my_car.condition

class ElectricCar(Car):
    def __int__(self, model, color, mpg, battery_type):
        Car.__init__(self, model, color, mpg)
        self.battery_type = battery_type

my_car = ElectricCar("Honda", "Blue", 32, "molten salt")


#2

Hi that line

def __int__(self, model, color, mpg, battery_type):

you wrote __int__ instead of __init__


#3

Grr,,, and I looked to make sure I did not post a misspelled code.

Thank you.


#4

Hi there,

Why do I need this line Car.init(self, model, color, mpg) ?


#5

To initialize the variables without reinputting

self.color = color
self.model = model
self.mpg = mpg