New course! Every coder should learn Generative AI!
Try a free lesson+ 2
Why 1 is output?
m = [1,9,3,5,8,3,3,6,1,8] print(m[m[4]])
2 Answers
+ 2
m[4] == 8
so m[m[4]] == m[8]
and m[8] == 1
+ 1
m[4] is 8
So, m[m[4]] is m[8]
and then m[8] is 1
m = [1,9,3,5,8,3,3,6,1,8] print(m[m[4]])