Question: PYTHON - MAKE IN ONE FUNCTION Problem 3 get_row(M,N): Return closest row that sums up to N that is in M [5 points]. Write a
PYTHON - MAKE IN ONE FUNCTION
Problem 3 get_row(M,N): Return closest row that sums up to N that is in M [5 points]. Write a function that takes a multi-dimensional array M, and a number N. Return the row in M that sums to the closet number to N. If there is no row that sums to N in M, but there are two rows that have sums that are equi-distant to N, then choose the first row. For example assume N is 11:
| 1 | 3 | 6 |
| 2 | 7 | 1 |
| 5 | 2 | 3 |
The function should return a numpy array [1,3,6].
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
