Question: Exercise 5 (2.0 point) The random_se lection function below should return an 1D array containing the values from each row of the input array original

 Exercise 5 (2.0 point) The random_se lection function below should return

Exercise 5 (2.0 point) The random_se lection function below should return an 1D array containing the values from each row of the input array original that are closer to the number Hint: Use the numpy method argsort PS. Refrain from using for and whi le loops n [15]: import numpy as np def random_select ion(or iginal): # BEGIN SOLUTION # END SOLUTION return(result) In [16]: # if your code works properly, the asserts below should not raise a message from numpy.testing import assert array_equal v np. array(I[ 0, 7, -41. I 6, 3, 4 I-8, 4, 6]]) asser t_array-equal(random-se lection(v)..array( [O, -1, 3, 2. -4])) assert array_equal (random_selection(np.array(-1,0,1], [2.5,0,3]])), np.array ([1,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!