main.py406 chars17 lines
This function calculate_weekly_avg
takes a list of stock values and calculates the weekly average starting with Monday as the beginning of the week. The function first checks if the number of stock entries is divisible by 7 to ensure that there are complete weeks of data. It then calculates the average of each week's stock prices and returns a list of weekly averages.
gistlibby LogSnag