Exp 7 python

0

 Create a program that defines a class to represent a car and then creates an object of that class with specific attributes. 


class Car:

    def __init__(self, make, model, year, color):

        self.make = make

        self.model = model

        self.year = year

        self.color = color


my_car = Car("Toyota", "Camry", 2022, "Blue")


print("Make:", my_car.make)

print("Model:", my_car.model)

print("Year:", my_car.year)

print("Color:", my_car.color)

Post a Comment

0Comments

GUYS IF YOU HAVE ANY DOUBT. PLEASE LET ME KNOW

Post a Comment (0)