0

Why is the output is 8 in the following code?

list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]])

11th Dec 2022, 2:01 AM
Haru
Haru - avatar
1 Réponse
+ 2
The number at index 4 of the list is 5. Therefore, when we use this number as an index to access an element of the list, we get the element at index 5, which is 8.
11th Dec 2022, 2:36 AM
Calviղ
Calviղ - avatar