Question: Complete the method below that given a 2D matrix, it will reverse all the rows and columns. Ex: x-13 4] 0 011 then, rvrs(x)- array([[O,

![reverse all the rows and columns. Ex: x-13 4] 0 011 then,](https://s3.amazonaws.com/si.experts.images/answers/2024/08/66c898c1dd5db_33766c898c161b3b.jpg)
Complete the method below that given a 2D matrix, it will reverse all the rows and columns. Ex: x-13 4] 0 011 then, rvrs(x)- array([[O, 0], " "Check that method returns the correct output for several inputs" p-np. array ( [ 3 ] ) ; # # g-np. array ( [ 0 ] ) ; wd-3 . 0 np . testing . assert-allclose ( rvrs (p,g), wd) p-np.array ([[3,41, 10,011) q-np.array([[ 0,01,14,31]) np.testing.assert_allclose ( rvrs(p), q) p-np.array ([[3,4,5],[0,0,0]]); q-np.array ([[0,0,0,[5,4,3]]); np.testing.assert_allclose( rvrs (p), q) qnp.array([[1,1,1],[5,4,3]]); np.testing.assert_allclose( rvrs(p), q) p-np.array([[3,4,5],112,9,6]]) q np.array([[6,9,12],15,4,3]]); np.testing.assert_allclose( rvrs (p), g) p-np.array ([[3,4,5],[-1,-2,-311) q-np.array([[-3,-2,-1],15,4,3]]); np.testing.assert_allclose ( rvrs(p), q)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
