Class
Class
python
Copy
class Car:
self.make = make
self.model = model
self.year = year
def display_info(self):
def start_engine(self):
Explanation:
1. __init__ method: This is the constructor method that initializes the object's attributes.
2. display_info method: This method returns a string containing information about the car.
Copy
class Car:
self.make = make
self.model = model
self.year = year
def display_info(self):
def start_engine(self):
Explanation:
1. __init__ method: This is the constructor method that initializes the object's attributes.
2. display_info method: This method returns a string containing information about the car.