Learn practical skills, build real-world projects, and advance your career

Question 1:

Create a Vehicle class with max_speed and mileage instance attributes

class Vehicle:
    def __init__(self, max_speed, mileage):
        self.max_speed = max_speed
        self.mileage = mileage
        
        
car = Vehicle(220, 10000)
print(car.max_speed, car.mileage)
220 10000

Question 2:

Create a Vehicle class without any variables and methods

class Vehicle:
    pass

Question 3:

Create child class Bus that will inherit all of the variables and methods of the Vehicle class