Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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,
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started