Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 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
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