Question: in python please Sally is a data analyst at an investment bank. She is trying to analyse some historic stock market data to find overall

Sally is a data analyst at an investment bank. She is trying to analyse some historic stock market data to find overall gains and losses for a given period. Sally needs a function that given an array of daily stock prices returns the total gains and losses, to two decimal places, in an array with losses as the first item and gains as the second. For example: Closing Stock Price 78.41 85.18 91.09 90.57 91.02 103.61 105.88 103.77 110.13 108.89 105.09 103.17 110.13 108.89 105.09 The price was down from the previous day on the fourth, eighth and tenth days, losing 7.67 in total over all three days, and up on every other day, gaining 34.35 in total. : In this case, a correct program will return the following: (-7.67, 34.35] Function Description Complete the function calculate GainsAnd Losses in the editor below. The function must return an array with total losses as the first item and total gains as the second. Both items should be rounded to 2 decimal places. calculate GainsAnd Losses has the following parameters data: an array of numbers Constraints . 1 data 106 Test Result 103.11 110.13 108.89 105.09 The price was down from the previous day on the fourth, eighth and tenth days, losing 7.67 in total over all three days, and up on every other day, gaining 34.35 in total. : In this case, a correct program will return the following: (-7.67, 34.35) Function Description Complete the function calculate GainsAnd Losses in the editor below. The function must return an array with total losses as the first item and total gains as the second. Both items should be rounded to 2 decimal places. calculate GainsAnd Losses has the following parameter(s) data: an array of numbers Constraints . 1 data is 104 Test Results
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
