+ 1
I do you not understand
list =[1, 1, 2, 3, 5, 8, 13] print(list[list[5]]) result : Error
3 Answers
+ 2
Look at the error: it says IndexError â that means you are trying to index an element at an index that doesn't exist.
0
print(list[list[5]])
Is equal to
print(list[8]) === null
0
Indexing list at list[5], probably a duplication of code.
The inner inex should work fine list[5] = 8
Meaning the outer index becomes list[8]
Your array items are as follows:
0 1 2 3 4 5 6
1 1 2 3 5 8 13
So there is no index 8, and calling it results in a type None which is python's null type, null types cannot be printed.