Loading...
The Rolling Window
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- mid, senior
Problem
Write a function that computes the moving average of a list of numbers with a sliding window of size k. Return a list of averages, one for each complete window of k consecutive elements. Round each average to 2 decimal places.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.