I gave 3 arguments to function and it sad I gave 4. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I gave 3 arguments to function and it sad I gave 4.

I wrote this (see in program I added) And got message: ... a = number(537, 8, lst) Type error: __init__ takes 3 positional arguments but 4 were given Why is that? https://code.sololearn.com/cuKIHFxEf0Hh/?ref=app

11th Jun 2017, 5:39 PM
Superior
Superior - avatar
1 Answer
+ 10
You should precede all your arguments with 'self' as the first one in definition. As you are referring to it later in the code. def __init__(self, num1, num2, lst):
11th Jun 2017, 5:52 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar