Question: Python: - Use the Design Recipe to write a function diagonal_diff , that consumes an NxN matrix of numbers ( nested list or list of

Python:

- Use the Design Recipe to write a function diagonal_diff, that consumes an NxN matrix of numbers (nested list or list of lists) and returns the absolute difference between the sum of its diagonals.

Write 3 assertEqual statements to test your function.

- Use the Design Recipe to define a modified version of round_list from Lab 5. The function will consume that same arguments (a list, and a positive integer), but the list argument may contain any kind of data (including, in particular, other lists). The function should return None, and modify the provided list in-place.

Values of the list which are of float type should be rounded to a number of decimals according to the second parameter of the function. Items which are of list type should be passed recursivelyto round_list for processing. All other types should be left unchanged.

Input testing: if the first parameter is not a list, or the second parameter is not a positive integer, the function should leave the parameters unchanged (and still return None).

Write 3 assertEqual statements to test your function.

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!