Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago