+ 2
What is the output of this code? I do not understand how the output is 8
list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]])
3 RĂ©ponses
+ 8
list[4] ---> 5
so:
list[5] ---> 8
+ 6
The innermost set of brackets is checked first. That's:
list[4].
The value there is 5, so list[list[4]] equals:
list[5]
And that's 8.
+ 1
Thank you very much HonFu
Makes sense now