0
What is the output of this code? list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]])
Why is the output 8?
3 Answers
+ 11
the answer is 8 because what it does is it takes the 4th index of list which when you fill into the code is
print (list[5])
which is 8
+ 7
lixst = [1, 1, 2, 3, 5, 8, 13]
''' print(list[list[4]]) , do it separately, 1st '''
print(list[4]) # output is 5
print (list[5]) ''' 2nd part output is 8 '''
0
list = [1, 1, 2, 3, 5, 8, 13]
''' print(list[list[4]]) , do it separately, 1st '''
Ie, solve one by one
print(list[4]) # output is 5
print (list[5]) ''' 2nd part output is 8 '''