Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I want you to return number of oscar winners that less than 35 years old. No for loops allowed. Ex: x-[[25 1998] [43 1999]] then,
I want you to return number of oscar winners that less than 35 years old. No for loops allowed. Ex: x-[[25 1998] [43 1999]] then, your method should return 1 as the only age less than 35 is 25. Note that you code should NOT count the years. In : def psn(x): return count of all ages less than 35, for a 2D matrix. # YOUR CODE HERE raise NotImplementedError) In [ ]: #test area p-np.array([[1998, 25].[1999, 43]]) # p-np.arange ( 28,38).re shape ( 5,2) print(p) print(psn(p)) In :"Check that method returns the correct output for several inputs" #assert p-np.array ([[1998, 25],[1999, 43]]) q-1; np.testing.assert_allclose( psn(p), q) p np.arange(28,3a).reshape(t5,2) q-3 np.testing.assert_allclose(psn(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