+ 1

why the result is 8 ?

list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]]) why the result 8 and not 5 ?

26th Dec 2017, 11:52 PM
Bahaa Bauomy
Bahaa Bauomy - avatar
2 Antworten
+ 4
print ( list [ list[4] ] ) --> list [4] = 5 (as list counting starts with 0); print ( list [ 5 ] ) --> list [5] = 8 (same) print ( 8 ) ==> 8
27th Dec 2017, 12:00 AM
Eduardo Avancini Alves
Eduardo Avancini Alves - avatar
+ 1
wow XD thx bro you really helped me
27th Dec 2017, 12:07 AM
Bahaa Bauomy
Bahaa Bauomy - avatar