In [ ]: Write a function that takes two arguments, an array of day-of-week numbers and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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'). 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').
Expert Answer:
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
Journalize the following transactions for the Robe Company of Yorktown and below each entry show all calculations: 2014 Jan. Sold a truck for $1,250 that cost $6,750 and had accumu- lated...
-
(a) What is the most precise correct statement that you can make about the numerical value of the median of the data from source 2? Do not explain your answer. Hint: Here is a correct statement: The...
-
/** * WEB222 - Assignment 02 * * I declare that this assignment is my own work in accordance with * Seneca Academic Policy. No part of this assignment has been * copied manually or electronically...
-
Problem 4: The two compensator circuits (Fig. P4a) are used to improve the closed-loop system performance: 1) Derive the transfer functions to characterize the two circuits, and show that they can be...
-
This exercise shows that the signed-rank test can be used with paired data. Two gauges that measure tire tread depth are being compared. Ten different locations on a tire are measured once by each...
-
What happens to the rate at which heat passes through a window when the thickness of the glass is doubled, all else kept constant?
-
Which of the following indicates a satisfactory situation from the viewpoint of good internal control? (a) The cashier reports to the treasurer. (b) Payroll accounting reports to the controller. (c)...
-
Indicate whether each of the following items would result in net cash flow from operating activities being higher (H) or lower (L) than net income. (a) Decrease in accounts payable. (b) Depreciation...
-
A.TRUE / FALSE QUESTIONS TRUE_1.A conversion feature in a "convertible bond" bond allows bondholders to exchange each bond for a stated number of shares of common stock. ______2.Any bond rated Aaa...
-
International Foods, a U.S. company, acquired two companies in 2013. As a result, its consolidated financial statements include the following acquired intangibles: Intangible Asset Date of...
-
Tibet acquired a new office building on 1 October 20X4. Its initial carrying amount consisted of: Land Building structure Air conditioning system $000 2,000 10,000 4,000 16,000 The estimated lives of...
-
A curling stone thrown by the skip takes 4.8 s to travel 60 m. The stone collides with another stone. The collision is a glancing one. If the second stone is deflected 25 and travels 1.5 m/s,...
-
Background information: The supply chain profession entered the year leading the digitalization of ecosystems, delivering the customer experience, managing trade uncertainty, and applying circular...
-
Mest Company has nine employees. FICA Social Security taxes are 6.2% of the first $132,900 paid to each employee, and FICA Medicare taxes are 1.45% of gross pay. FUTA taxes are 0.6% and SUTA taxes...
-
When a wave reflects off a higher index of refraction medium than the one it is traveling in, is the reflected wave aligned in the same or opposite orientation as the incident wave? When a wave...
-
A roller coaster has 6 circular loops with varying radii. Given the speed of the cart through each loop, rank the force from the track on the cart at the bottom of each loop. What loop will make you...
-
write one paragraph about digital marketing and how to it can be effective for any business? Explain
-
Suppose Green Network Energy needs to raise money to finance its new manufacturing facility, but their CFO does not think the company is financially capable of making the periodic interest payments...
-
Suppose we have the following structure declaration: struct applicant { char name[30]; int credit_ratings[3]; }; a. Write a function that takes an applicant structure as an argument and displays its...
-
Write a C++ program that requests and displays information as shown in the following example of output: What is your first name? Betty Sue What is your last name? Yewe What letter grade do you...
-
What statement would you use to read a value from keyboard input into the variable cheeses?
-
Monopolistic competition is similar to both _________ and perfect competition. As in monopoly, firms have some control over market _________, but as in perfect competition, they face _________ from...
-
Due to the free entry of new firms, long-run economic profits in monopolistic competition are _________.
-
Can advertising increase demand?
Study smarter with the SolutionInn App