Keyword argument in python class

48 views Asked by At
class Car:
   def __int__(self, **kw):
          self.make = kw["make"]
          self.model = kw["model"]

my_car = Car(make="Nissan", model="GT-R")
print(my_car.model)

TypeError: Car() takes no arguments, even though I initialized it as a multiple keyword argument

1

There are 1 answers

2
farzany On BEST ANSWER

You misspelled "init". That should fix it :)