Exercise: Accessing 2-Dimensional Arrays

Let's slice a 2-dimensional array in this exercise.

We'll cover the following

Task #

In this exercise, we will use different techniques to extract useful information from a 2-dimensional array.

Problem statement #

For the array arr given in the code below, write code to print:

  • the first row of arr
  • the first column of arr
  • the third row of arr
  • the last two columns of arr
  • the 2 by 2 block of values in the upper right-hand corner of arr
  • the 2 by 2 block of values at the center of arr

Get hands-on with 1400+ tech skills courses.