0
TypeError:
https://code.sololearn.com/ctDhqRpE48HG/#py i put in from numstring import NumString five = NumString(5) i get this Traceback (most recent call last): File "<pyshell#14>", line 1, in <module> five = NumString(5) TypeError: __init__() takes 1 positional argument but 2 were given
4 Antworten
+ 3
There are two methods called __init__ in your class. The second one overrides the first one. Since it doesn't take any arguments (other than self), you can't call NumString(5). You probably meant to call the second method __int__ instead of __init__.
0
And that's bcz you've two constructor methods in the NumString class. Omit the second one and you're good to go.
0
What does that mean?
0
Thanks you Anna