How to add fields in a constructor
已回答
This is my code:
class Ship:
def __int__(self, name, weight):
self.name = name
self.weight = weight
costa = Ship("")
when I try to add the arguments to the variable costa the program tell me about the unexpected argument, how can I fix the problem?
请先登录再写评论。
There's a small typo in the __init__ function definition. The function name is missing an 'i' between the 'n' and the 't'.