I am struggling with the inheritance from two parents. I want to inherit from both the "super car" and the "cargo car" in order to be able to create a "super cargo car". When I call the code from below, I get:
"TypeError: __init __ () missing 1 required positional argument: 'capacity'"
class Car:
def __init__(self, brand, colour):
self.brand = brand
self.colour = colour
class SuperCar(Car):
def __init__(self, brand, colour, max_speed):
super().__init__(brand, colour)
self.max_speed = max_speed
def introduce_yourself(self):
statement = f"My colour is {self.colour} and my max speed is {self.max_speed}"
return statement
class CargoCar(Car):
def __init__(self, brand, colour, capacity):
super().__init__(brand, colour)
self.capacity = capacity
def introduce_yourself(self):
statement = f"My colour is {self.colour} and my capacity is {self.capacity} KG"
return statement
class SuperCargoCar(SuperCar, CargoCar):
def __init__(self, brand, colour, max_speed, capacity ):
super().__init__(brand, colour, max_speed)
self.capacity = capacity
def introduce_yourself(self):
super().introduce_yourself()
statement = f'My colour is {self.colour}, my max speed is {self.max_speed} ' \
f'and my capacity is {self.capacity} KG'
return statement
super_cargo_car = SuperCargoCar(brand="Volvo", colour="Green", max_speed=200, capacity=5000)
print(super_cargo_car.introduce_yourself())```