Doubt in 2D array indexing

m =[ [1,2,3,4,5,6,7,8,9,10],
[11,12,13,14,15,16,17,18,19,20] ]

Please provide Explanation.

Hi @pavithrapandu134,
m[1] --------> [11,12,13,14,15,16,17,18,19,20]
m[1][1:8] --------> [12, 13,14,15,16,17,18] (as the index range specifies will exclude the last one ‘19’)
if the index range is specified as 1:8:2 , it means that there is a step of 2 while ranging the index. It means the indexes considered are 1,3,5,7

So, the output will be:
m[1][1:8:2] ---------> [12,14,16,18]

Hope this clears your query.

1 Like

Hi @pavithrapandu134,
I think the answer explained by @riteshvesalapu is absolutely correct. But you are working with list of lists and not with 2D array. If you check the type of m, it is list. If you apply the functions like ndim or shape or size on m you will get an error.