+ 1
I wrote following code but it gives syntaxError in "def __len__(self) . Can anyone explain to me,please. why?
5 odpowiedzi
+ 4
I think there is also an error in line 33, it should be like this?
int_list = IntList ([2, 1, 4, 3, 5, 6, 7, 8])
+ 2
I got your mistake, you can checkout this code
https://code.sololearn.com/c9jI1kHlM4d9/?ref=app
+ 1
the only mistake you had done was you were missing ']' in line 27
+ 1
Your "int_list" is a TUPLE that contain a list.
Now, if your try to access at third member of "int_list" you will get an Index out of range error because the "int_list" TUPLE has ONE item only.... If you want access to 3rd item of first tuple item you can do :
int_list[0][2]
int_list[0] access to tuple (with one element only) and [2] access to 3rd item of this element
0
Pulkit Kamboj I checked out your modification but it says in line 31 it's out of range.
Yeah i got it finally . Thank you.