Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Car:
- def __init__(self, brand, model, year):
- self._brand = brand
- self._model = model
- self._year = year
- def get_info(self):
- return f"The car is made by {self._brand}, its model is {self._model} and it was made in {self._year}"
- def change_production_year(self, new_year):
- self._year = new_year
- return f"The production year of {self._brand} {self._model} was changed to {self._year}"
- car_1 = Car('Mercedes', 'S-class', '2024')
- car_2 = Car('Audi', 'RS7', '2024')
- print(car_1.get_info())
- print(car_2.change_production_year(2025))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement