 List=[1,1,2,3,5,8,13] print (list[list]) | SoloLearn: Learn to code for FREE!

0

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

Output 8 why??? Now position 4 is 5 but it display the 8

+4

Yogeshwari M . If you want to print the 4 position The correct sintax to use is print(list) When you do print(list(list) You are printing list in position In the result of list. That is position 5

+3

n = list What's the value of n? What's the value of list[n]?

+3

print(list) Output = 5 print(list[list]) list is equal to 5 So list[list] is equal to list So we have print(list) Output is 8

+3

+2

Just look at your code carefully Here's what it says print(list[list]) >> list // 5 cames here the way that you told above >> 8 Simply it asks for the value corresponding to the value at index 4

+1

I can do ya print(list[list]) It cames 8 not 5

+1

Thankyou for ur explanation

0

This question from the quiz has been bugging me for some time, trying to understand why the output is 8. Thanks to Anya's explanation I get what the code has been telling me all along. Talk about starring blind. Thank you, Anya.