class Car:
def __init__(self, make, model, year):
self.make = make
self.model = model
self.year = year
def get_info(self):
return f"{self.make} {self.model} ({self.year})"
# Create a Car object
my_car = Car("Toyota", "Corolla", 2020)
# Print the current make and model
print(my_car.get_info()) # Output: Toyota Corolla (2020)
# Change the make of the car
my_car.make = "Honda"
# Print the updated make and model
print(my_car.get_info()) # Output: Honda Corolla (2020)
Car
` class with an `__init__()
` method that initializes the make, model, and year properties of a car object. get_info()
` method that returns a string containing the make, model, and year of the car.