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())
Why Car() takes no arguments
|
Why Car() takes no arguments
|
|
Jun-25-2020, 03:11 AM
You have typo on line#3. The function should be
__init__
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
Jun-25-2020, 03:16 AM
tq buran
|
|
|
Users browsing this thread: 1 Guest(s)
