Find max(and min) on the moving interval using python
I have a array like [5.5, 6.0, 6.0, 6.5, 6.0, 5.5, 5.5, 5.0, 4.5]. all numbers of this array differ by 0.5, and the maximum difference of two successive numbers is also 0.5(they can be same; as in the example). and there is a moving interval, or box, which covers, for example, 3 successive numbers, like this: [(5.5, 6.0, 6.0), 6.5, 6.0, 5.5, 5.5, 5.0, 4.5] # min: 5.5, max: 6.0 and the box moves toward right one by one: [5.5, (6.0, 6.0, 6.5), 6.0, 5.5, 5.5, 5.0, 4.5] # min: 6.0, max: 6.5 [5.5, 6.0, (6.0, 6.5, 6.0), 5.5, 5.5, 5.0, 4.5] # min: 6.0, max: 6.5 the question is, how can I find the min