Given:
class Vehicle: def __init__(self, name, max_speed, mileage): self.name = name self.max_speed = max_speed self.mileage = mileage
Create a Bus object that will inherit all of the variables and methods of the parent Vehicle class and display it.
Expected Output:
Vehicle Name: School Volvo Speed: 180 Mileage: 12
class Vehicle: def __init__(self, name, max_speed, mileage): self.name = name self.max_speed = max_speed self.mileage = mileage class Bus(Vehicle): pass School_bus = Bus("School Volvo", 180, 12) print("Vehicle Name:", School_bus.name, "Speed:", School_bus.max_speed, "Mileage:", School_bus.mileage)
Explanation in video:
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Explanation in video:
need an explanation for this answer? contact us directly to get an explanation for this answer