- 1
Can anyone explain please?
list = [ 1,1,2,3,5,8,13 ] print (list[list[4]])
3 Answers
+ 5
list[list[4]]
list[5] # list[4] is 5
8
#index starts from 0
+ 1
So i need to add 1 index.
When list[list[index]] right....
+ 1
SELVANITHISH SELVANITHISH
No it is not like that.
As index start from 0 so your 5th element will be at 4th index.
So here list[4] = 5 #here 4 means 5th element and 5th element is 5
Now you have list[4] inside another list so here
list[list[4]] = list[5] = 8 #here 5 is 6th element which is 8