Calculate moving average with window size k. Example: [1,2,3,4,5], k=3 => [2.0, 3.0, 4.0]
Implement this function:
def moving_average(lst: list, k: int) -> list:
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: lst, k.
Input
[1, 2, 3, 4, 5]
3
Output
[2.0, 3.0, 4.0]