Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 480 Bytes

README.md

File metadata and controls

24 lines (17 loc) · 480 Bytes

Calculating a moving average using python

You are given a list of numbers J and a single number p.

Write a function to return the minimum and maximum averages of the sequences of p numbers in J. Example:

   J = [4, 4, 4, 9, 10, 11, 12]

   p = 3

The sequences will be:

    (4,4,4)
    (4,4,9)
    (4,9,10)
    (9,10,11)
    (10,11,12)

Minimum average will be 4 and the maximum average will be 11, which corresponds to the first and last sequences.