Q:

Write a Python program to create a Vehicle class with max_speed and mileage instance attributes.

belongs to collection: Python OOP Exercises

-3

Create a Class with instance attributes

Write a Python program to create a Vehicle class with max_speed and mileage instance attributes.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

class Vehicle:
    def __init__(self, max_speed, mileage):
        self.max_speed = max_speed
        self.mileage = mileage

modelX = Vehicle(240, 18)
print(modelX.max_speed, modelX.mileage)

 

Explanation:

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Create a Vehicle class without any variables and m... >>