From the course: Get Ready for Your Coding Interview

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

Practice problems for 2D arrays

Practice problems for 2D arrays

- [Instructor] Here are some exercise problems for using two-dimensional arrays in Python. Problem one: Initialize a new 2D array with one, two, three in the first row and five, six, seven in the second row. Store it in a new variable called a_2d. For this one, I'm going to to write a_2d = square buckets one, two, three, to represent the first row and another set of square brackets, five, six, seven to represent the second row. And when we print a_2d, we should be able to print one, two, three, and five, six, seven. and we see one, two, three, five, six, seven here. Problem two: From the 2D array called b_2d, defined below, replace the number six with the number of 99. Our 2D Array b_2d contains the first row with one, two, three, and the second row with five, six, seven. And we want to replace the second number in the second row, which is six with the number 99. To do that, I'm going to write b_2d, square brackets one…

Contents