New course! Every coder should learn Generative AI!
Try a free lesson+ 1
if list[4]=5
list[list[4]] is the same as
list[5]
and list[5]=6
+ 4
inner list: list[4] is 5. (index of outer list)
outer list: list[5] is 6.
+ 2
Ben Rückert
= list[list[4]]
at index 4 value is 5 so list[4] = 5
= list[5] // now here index will be 5
= 6
+ 2
understanding that list[4]=5
and that list[5]=6
just replace 5 with list[4]
and you get
list[list[4]]=list[5]=6
+ 1
Ben Rückert
normally you have this: list[index]
list[0], list[1] and so on
but in your case the index is also a value from the list
index = list[4] = 5
list[index] = list[5] = 6