+ 1

I do you not understand

list =[1, 1, 2, 3, 5, 8, 13] print(list[list[5]]) result : Error

31st Dec 2021, 2:52 PM
ABOxTRKi
ABOxTRKi - avatar
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.
31st Dec 2021, 3:14 PM
Lisa
Lisa - avatar
0
print(list[list[5]]) Is equal to print(list[8]) === null
31st Dec 2021, 4:47 PM
Pariket Thakur
Pariket Thakur - avatar
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.
2nd Jan 2022, 9:30 AM
AnonyMouse
AnonyMouse - avatar