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

22nd Jun 2018, 8:21 AM
Arun machad
5 Antworten
+ 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. :)
22nd Jun 2018, 10:19 AM
Janning⭐
Janning⭐ - avatar
+ 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])
22nd Jun 2018, 9:19 AM
ihateonions
0
list[4] # returns 5 list[5] # returns 8
22nd Jun 2018, 8:52 AM
Qwertiony
Qwertiony - avatar
0
what is the meaning of list[list[4]]
22nd Jun 2018, 9:23 AM
Arun machad
0
https://code.sololearn.com/cw0xczX05IS7/?ref=app can u pls explain this one how result showing 6
24th Jun 2018, 9:13 AM
Arun machad