0
How compiler understand 2nd list item in nested list
eg. nums[5,4,3,[2],6] here nums[3][0] is 2 in 2nd list how?
3 Answers
+ 1
It's done in steps. First, nums[3] is acquired and a temporary reference to it (e.g., tempnums) is created. Then tempnums[0] is requested (it contains one item: 2), that value is returned and the temporary variable is released.
+ 1
Its better if we separate it like this. First nums[3] is executed and it returns a list. Now i can use that list and retrieve it's elements. In this case we have only 1 element. so nums[3][0] will return the value. Don't think it as 2d list.
0
means 2nd list at 3rd index in 1st list and
in that 2nd list first item is 2 ,so
nums[3][0] is 2
actually 2d list is 1d