Why the output of print(list[list[4]]) is 8 when 8 is in index 5? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why the output of print(list[list[4]]) is 8 when 8 is in index 5?

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

12th Dec 2020, 2:26 PM
mc anthony amaro
mc anthony amaro - avatar
2 Answers
+ 3
print ( list [ list[4] ] ) #list[4] = 5 print ( list [ 5 ] ) #list[5] = 8 print (8) >> 8
12th Dec 2020, 2:29 PM
noteve
noteve - avatar
0
thank you for your answer but the output if you print(list[list[4]]) is 8 not 5
12th Dec 2020, 3:50 PM
mc anthony amaro
mc anthony amaro - avatar