0
how this possible. can u pls explain it
List = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]]) output is 8 how pls tell me https://code.sololearn.com/cC900ci2yEuj/?ref=app
5 Answers
+ 2
Good question, Arun!
list[list[4]]
when evaluated, becomes
list[5]
because list[4] returns 5, as Qwetiony said (with more brevity)
and then list[5], when evaluated, returns 8 (as Qwetiony also said, but again with more brevity)
I hope this helps break it down for you a little more. :)
+ 1
Arrays in python always start from 0 and not 1. Also change your code to the below and it will work correctly for you.
list = [1, 1, 2, 3, 5, 8, 13]
print(list[4])
0
list[4] # returns 5
list[5] # returns 8
0
what is the meaning of list[list[4]]
0
https://code.sololearn.com/cw0xczX05IS7/?ref=app
can u pls explain this one
how result showing 6