Daily active users are noisy, so the product team reports a smoothed trend line instead.
Write a function moving_average(values, window) that returns a list of rolling averages, each rounded to 2 decimals. Use only full windows — a list of length n with window k returns n - k + 1 values. Return an empty list if the window is larger than the data.
More NumPy questions
Asked at Google
Practising alone only goes so far — our live cohorts pair Python and Pandas depth with dashboards, agentic analytics projects and mock interviews.
Explore the program