+ 2

what is this code mean?

list = [1,1,2,3,5,8,13] print(list [list [4]]) I don't know the line 2, nesting of two list

30th Mar 2018, 9:10 AM
Petter Aaron
Petter Aaron - avatar
1 Odpowiedź
+ 8
It means take the list item indexed 4 (the number 5) and use it as an index indicator. list[4] == 5, so: list[list[4]] == list[5] == 8
30th Mar 2018, 9:23 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar