Question: Python Problem 1. (20 pts) Write a function called stock_change() that accepts a list of stock values and determines if the average of the first

Python Problem 1. (20 pts) Write a function called stock_change() that accepts a list of stock values and determines if the average of the first half of the stocks is less than, or greater than, or equal to the average of the second half of the stock values. Assume that you will always have an even number of stocks in the list. Use print statements to communicate the results.

"average stock value has decreased" "average stock value has increased" "average stock value is unchanged"

In addition to the print statements, **return** a list containing the average of the lower half and the average of the upper half rounded to one decimal place.

# Problem 1

def stock_change(data):

# YOUR CODE

# Test 1

stocks_dn=[4,3,6,4,1,2,3,2]

stock_change(stocks_dn) # prints 'average stock value has decreased'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!