Overriding methods drive_car() problem


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>
Hey all. Can You please help me? I got stuck with an error i cant understand.

Traceback (most recent call last):
File “python”, line 20, in
TypeError: drive_car() takes no arguments (1 given)

As You can see i didnt give any arguments into drive_car()
Please help
<What do you expect to happen instead?>

```python

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, str(self.mpg))
def drive_car(self):
self.condition=“used”

class ElectricCar(Car):
def init(self, model, color, mpg, battery_type):
Car.init(self, model, color, mpg)
self.battery_type=battery_type
def drive_car():
self.condition=“like new”
my_car=ElectricCar(“BMW”, “GREEN”, 999, “molten salt”)
print my_car.condition
my_car.drive_car()
print my_car.condition

<do not remove the three backticks above>

Overriding Methods - What is Wrong?
#2

@javablaster92540,

class ElectricCar(Car):
    def __init__(self, model, color, mpg, battery_type):
        Car.__init__(self, model, color, mpg)
        self.battery_type=battery_type
    def drive_car(self):
        self.condition="like new"