Python Forum

Full Version: Why Car() takes no arguments
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
class Car:

    def __int__(self,make,model,year):
        self.make = make
        self.model = model
        self.year = year

    def get_descriptive_name(self):
        long_name = str(self.year) + ' ' + self.make + ' ' + self.model
        return long_name.title()


my_new_car = Car('audi','a4','2016')
print(my_new_car.get_descriptive_name())
You have typo on line#3. The function should be __init__
tq buran