Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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. Start with the following code below Save the file as vehicles_class,py Your output should look like this: I have 3 cars The Mercedes is a black SUV. The BMW is a silver Sedan The Ferarri is a red Super Car And they all have 4 wheels, of course Starter Code: 2 class Vehicles: def init (selt, cars): self.cars cars 9 # Parent class 18 class Car: 12 13 14 15 16 # Class attribute Wheels 4 Initializer Instance attributes def init (self, aake, cotour): self.rake make self.colour colour 18 19 # Instance nethod def description(self): return f"Theis a. # Create a suv class inherits fron car class): 25 class SUV(Carl: 26 def init o super).init( inherited attributes go here " 29 # Create Sedan class {inherits from Car class): 31 # Create a SuperCar class { inherits from Car class): 34 # create instances of cars 35 AMG GLS63 SuVC) 36 M5-Sedan 37 F68SuperCar) 39 y cars 41 Instantiate the Vehicle class 42 y cars Vehictes) 44 # Output 45 print (fI have cars:" 46 for car in ey cars.cars: print() 19 print And they all have heels, of 1/3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started