Why Car() takes no arguments - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Why Car() takes no arguments (/thread-27867.html) |
Why Car() takes no arguments - louis216 - Jun-25-2020 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()) RE: Why Car() takes no arguments - buran - Jun-25-2020 You have typo on line#3. The function should be __init__
RE: Why Car() takes no arguments - louis216 - Jun-25-2020 tq buran |