Question: A python program Suppose that you have a two-dimensional array (list of lists) of numeric values where each row of the array has the same

A python program

Suppose that you have a two-dimensional array (list of lists) of numeric values where each row of the array has the same number of elements. For example, the following array has two rows of five elements:

t = [[8, 1, 6, 3, 5], [7, 0, 4, 9, 2]]

If you print the rows on top of one another then you get something that looks like a matrix:

8 1 6 3 5 7 0 4 9 2

In the module question2.py, write a function size(t) that has a two-dimensional array t as a parameter and returns a list of length 2 where the first element of the returned list is the number of rows in t and the second element is the number of columns in t.

For the array shown above the function should return the list:

[2, 5]

If t is an empty array then the function should return the list [0, 0].

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!