Class-Object

Wed 12 November 2025
class Car:
    def __init__(self, brand, model):
        self.brand = brand
        self.model = model

    def display_info(self):
        print(f"Car Brand: {self.brand}, Model: {self.model}")


my_car = Car("Toyota", "Corolla") # ---> this is the object for that class
my_car.display_info()
Car Brand: Toyota, Model: Corolla


Score: 0

Category: python-basics