Int 3 for Programmers
The fastest stretch of growth
A greenhouse records the height of a plant in millimetres, always the same number of days apart. You are asked which stretch between two consecutive readings had the fastest growth, and how fast that was.
Write fastest_growth(heights, gap), which returns the largest average rate of change between two consecutive readings, in millimetres per day. gap is the number of days between readings.
Worked example, with heights = [40, 110, 180, 240] and gap = 7. The three stretches give , and . The largest is 10, so the answer is 10.
heights has at most 50 entries, and gap is between 1 and 30.Run your code to see how it does on the examples. Submit also runs the hidden cases.