+ 2
I didn't see this covered in the lesson and I can't move forward til I understand
What is the output of this code? list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]]) Please explain to me what this is asking, how the answer is 8, and please give an alternative example. I do not want to go forward until I understand.
5 Respostas
+ 7
The inner part list [4] = 5 then list [5]=8
You should first find the value of the most inner part
+ 5
list[list[4]]= list[5]=8
The value at 4th index is 5 and the value at 5th index is 8
list[list[0]]=list[1]=1
can you understand?
+ 2
it always follows order of operations :)
+ 1
It's like var=list [4]
a=5
list [a]
Print (List[5])
8
+ 1
OMG. I didn't comprehend that at all. It's like an order of operations.
Get the inner index first then get the index of the outer. THANKS SO MUCH!