How to Access 2D and 3D through Slicing

Question:
Hi I am trying to understand this piece of code can someone help me
How this “::” double colon actually works i changed the figures but still not getting it
Capture_1

1 Like

Think about the 2D array as a 1D array of 1D arrays inside. You’ll be slicing over each dimension from the outside to the inside.
The first :3 will be selecting the first three 1-dimensional arrays (the first three rows of your 2-dimensional array). The second ::3 will be slicing over each 1-dimensional array with a 3-step value (slicing over the columns of your 2-dimensional array).