+ 1

list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]])

This list[4] within the print(list) makes the fourth value get skipped and you end up printing the fifth placeholder. The answer is 8

12th Feb 2021, 11:20 PM
Tom Clark
Tom Clark - avatar
3 Respostas
+ 3
list[4] evaluates to 5. So, list[list[4]] is the same as list[5] which evaluates to 8
12th Feb 2021, 11:39 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
hmm , i see a downvote in both AJ sir's and ChaoticDawgs Answers ... 👀
14th Feb 2021, 7:46 AM
Alphin K Sajan
Alphin K Sajan - avatar
0
Tom Clark To understand this type of problem you can you can divide your program in small pieces like list[list [4]] You can store list[4] in another variable b = list[4] so now your code will look like list[b] Now b is 5 so list [5] will be 8
13th Feb 2021, 4:48 AM
A͢J
A͢J - avatar