0
Need help understanding (list[list[4]])
list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]]) Not sure how answer is 8? Can someone help me understand? Thank you
4 Antworten
+ 4
List[4] returns 5
So,
list([list[4]]) means list[5]
&
list[5] returns 8
That's why it returns 8
+ 1
start on the innermost one and work out.
list = [1,1,2,3,5,8,13]
list[list[4]] # list[4] == 5
list[5] # list[5] == 8
# output
8
+ 1
Jason DeNault Welcome && Keep Learning Bruh 🙂🤟
0
Niirmaal twaatii Thank you now I understand.