Question: In [ ]: Write a function that takes two arguments, an array of day-of-week numbers and an array of rainfall amounts and returns the
![In [ ]: Write a function that takes two arguments, an array](https://dsd5zvtm8ll6.cloudfront.net/questions/2024/02/65c2730d55584_1707242247440.jpg)
In [ ]: Write a function that takes two arguments, an array of day-of-week numbers and an array of rainfall amounts and returns the midweek and weekend average rainfall as defined by the NASA researchers. Remember to check how you are supposed to define weekend and mid-week. Remember, you can return multiple results by packing them into a tuple. I strongly recommend using numpy array boolean functions to group your days into midweek and weekend; looping is likely to be too slow when you call your function thousands of times in the next part. You should not write a for loop that tests if each item! 1 #Put the code for your function here. 2 3 #now call your function and store the returned values in variables midwk 4 #and wkend 5 midwk = 0 6 wkend = 0 7 #then compute their difference in variable delta 8 delta midwk - wkend 9 10 11 print ('It rained', midwk, 'inches mid week'). 12 print('It rained', wkend, 'inches weekend'). 13 print('Difference was', delta, 'inches').
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
