Define a function running_average that takes an iterable and return a generator that generates running averages, i.e., t
Posted: Wed Mar 30, 2022 9:25 am
Define a function running_average that takes an iterable and return a generator that generates running averages, i.e., the i -th element is the average of the first i items of the iterable. For example: Test Result assert (*running_average(range (0))] [] assert [*running_average (range (10))] == [0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5] Answer: (penalty regime: 10, 20, ... %) 1