0

list Python

list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]]) why the answer here is 8

16th Mar 2020, 11:44 PM
Jenda Mustafa
Jenda Mustafa - avatar
3 Respostas
+ 1
Read it from inside out. list[4] is 5. So the outer access is actually list[5]. Which is 8.
16th Mar 2020, 11:47 PM
HonFu
HonFu - avatar
+ 1
Thank you
16th Mar 2020, 11:52 PM
Jenda Mustafa
Jenda Mustafa - avatar