Question: Exercise 1 [Rectangular Matrices] Write a function is Rectangle() that takes a list of lists as a parameter and returns a Boolean (either True or
![Exercise 1 [Rectangular Matrices] Write a function is Rectangle() that takes](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f31f67f3fdb_31966f31f6758832.jpg)

Exercise 1 [Rectangular Matrices] Write a function is Rectangle() that takes a list of lists as a parameter and returns a Boolean (either True or False) if the list of lists is rectangular (i.e., every "row" has the same length). For example, >>> isRectangle([["0","1"],["2", "3"]]). True >>> isRectangle([["0","1"],["2","3","4"]]) False The function should not care what the data looks like. The examples above are strings but they could be anything. Exercise 2 (Checking for Integers] Write a function is NumericalHelper() that takes a list of strings as a parameter and returns a Boolean (either True or False) to indicate whether or not every element in the list is an integer or not. You can check if a given string is a non-negative integer using the isdigit() string function. How can you use this to detect negative integers too? For example, >>> isNumericalHelper (["0","1","-13"]) True >>> isNumericalHelper (["0","1.32","22","x"]) False Do NOT use try/except for this. Exercise 3 [Checking for integer matrix] Write a function isMatrix() that takes a list of lists of strings as input and returns a Boolean (either True or False) to indicate whether or not the list of lists is rectangular and and contaings all strings that are integers. Use the functions you created for the last two exercises. Exercise 4 [Displaying a Matrix] Write a function printMatrix() that takes a list of lists of strings as input, checks if it is an integer matrix (see last problem), and then prints it out. Print out an error message or just an empty matrix (i.e., [])) if the parameter is not an integer matrix. For example: >>>printMatrix(("0","1","2"],["3","4","5",), ("6","7","9"]]) 10121 | 3 4 5 1 6781 >>> printMatrix([["0"], ["1", "2"]]) 0 Can you make all the numbers in the matrix line up nicely aligned to the right)? When using f- strings, you can have nested braces {} to embed variables in the formatting details. For example, consider the following >>>width = 10 >>>word = 'cat' >>>f'the word is (word:>{width)).' 'the word is cat.' The outer {}'s hold the first evaluation (the string word) and the inner {}'s hold another evaluation to specify the minimum length of the created string
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
