Write a function rainy_days (rainfall) which takes a nested list rainfall (type is NumPy array). Then, the function retu

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
correctanswer
Posts: 43759
Joined: Sat Aug 07, 2021 7:38 am

Write a function rainy_days (rainfall) which takes a nested list rainfall (type is NumPy array). Then, the function retu

Post by correctanswer »

Write A Function Rainy Days Rainfall Which Takes A Nested List Rainfall Type Is Numpy Array Then The Function Retu 1
Write A Function Rainy Days Rainfall Which Takes A Nested List Rainfall Type Is Numpy Array Then The Function Retu 1 (244.31 KiB) Viewed 71 times
Write a function rainy_days (rainfall) which takes a nested list rainfall (type is NumPy array). Then, the function returns the week with the lowest rainfall observed. Week index starts from 0 (i.e., the first row is week 0, the second row is week 1 etc.). If the week's data does not contain each day's information (i.e., some data missing or extra days added), then that week's data is ignored wholly (but it is still counted as a week). If there are no valid weeks (all weekly measures are invalid), then the function returns -1. You can assume all values in the NumPy array are numbers. You can also assume no two weeks will have to same average rainfalls. For example: Test Re rainfall = np.array([ 2 [0.2, 0.0, 1.6, 4.8, 9.0, 1.2, 1.4], [3.6, 2.2, 0.0, 0.2, 3.0, 0.3, 1.3], [0.2, 0.4, 0.9, 0.0, 1.5, 0.0, 1.6] 1) #week 1 total 18.2 #week 2 total 10.6 #week 3 total 4.6 print (rainy_days (rainfall)) rainfall = np.array([ [0.2, 0.0, 1.6, 4.8, 0.0, 1.2], [0.2, 0.4, 0.9, 0.0, 1.5, 0.0, 1.6, 0.4] ]) #all weeks are invalid measurements, so return -1 print (rainy_days (rainfall)) -1
Register for solutions, replies, and use board search function. Answer Happy Forum is an archive of questions covering all technical subjects across the Internet.
Post Reply