What is wrong with the inherinted class?


error message " Traceback (most recent call last):
  File "python", line 26, in <module>
TypeError: 'str' object is not callable "
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"
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):
        self.battery_type = battery_type
        self.model = model
        self.color = color
        self.mpg = mpg
    def drive_car(self):
        self.condition = "like new"
my_car = ElectricCar("Camery", "Black", 220, "molten salt")
print my_car.condition()
print my_car.condition()


Hello @bytemaster34725,

the "O" in object should be capital, and try removing the parentheses of my_car.condition. That should fix your problem...


Read this article



and read this, so you know what you are doing....


thanks alot. but i have been using small "o" ever since. let me try your solution


removing the parenthesis in the print statement worked. but i did maintain the small "o" i the object. my code finally worked. thanks leonhard.wettengmx.n