Reference no: EM132238569
Create a Vehicles class that holds instances of cars; this class is completely separate from the Car class. In other words, the Car class does not inherit from the Vehicle class. Then assign three car instances to an instance of the Vehicle class.Create MERCEDES CLASS, BMW class, and ferrari class , all inheritance of car class
starter code below:
class Vehicle :
car=()
def __init__(self,car):
self.car=car
class Car:
wheels =4
def __init__(car,make,colour):
self.make=make
self.colour=colour
def description (self):
return f('{} is a {} {}.')
class Suv(car):
def __init__(self):
super ().__init__(make ,colour)
class Sedan (car):
def__init__(self,)
super ().__init__()
class Supercar (car):
def __init__(self)
super ().__init__()
# create instances of cars
my_cars=()
# instantiate the Vehicle class
mycars=vehicles ()
Your output should look like this:
I have 3 cars:
The Mercedes is a black suv.
The BMW is a silver sedan.
The ferrari is a red supercar .
and they all have 4 wheels of course.