-3
class Car():
"""Uma tentativa simples de representar um carro."""
def _init_(self, make, model, year):
"""Inicializa os atributos que descrevem um carro."""
self.make = make
self.model = model
self.year = year
def get_descripte_name(self):
"""Devolve um nome descritivo, formatado de modo elegante."""
long_name = str(self.year) + " " + self.make + " " + self.model
return long_name.title()
my_new_year = Car("audi", "a4", 2016)
print(my_new_year.get_descripte_name())
briefly your init is only with an underscore on each side, it should be "_ init _ _" (no spaces), as this class would define the constructor with 3 inputs, because it does not exist it assumes the pattern, which is zero, so the error occurs because you try to pass 3
– Lucas Miranda
Thanks, now it’s working.
– Alice Ramos
The name of the manufacturer must be
__init__
, with two_
at the beginning and two more at the end. There is a tb typing error in the variablemy_new_year
, that should bemy_new_car
: https://ideone.com/sEVz7K– hkotsubo