Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Car:
- def __init__(self, color, model, manifacturer):
- self.color = color
- self.model = model
- self.manifacturer = manifacturer
- def new_color(self, color):
- self.color = color
- def new_model(self, model):
- self.model = model
- def new_manifacturer(self, manifacturer):
- self.manifacturer = manifacturer
- def get_info(self):
- print(f"""
- Color: {self.color}
- Model: {self.model}
- Manifacturer: {self.manifacturer}
- """)
- car_1 = Car("Red", "M4", "BMW")
- car_2 = Car("Blue", "A4", "Audi")
- car_3 = Car("Green", "Panamera", "Porsche")
- car_1.get_info()
- car_2.get_info()
- car_3.get_info()
- print("-----------------------")
- car_1.new_color("Purple")
- car_1.get_info()
- car_2.new_model("R8")
- car_2.get_info()
- car_3.new_manifacturer("Honda")
- car_3.get_info()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement