The Stream Averager
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L5
Problem
Implement StreamAverager with add(key, value) and get_averages(). add records a reading; get_averages returns a dict mapping each key to the average of its values. Test harness: ['add', key, value] and ['get_averages']; returns parallel list (None for add, dict for get_averages).
Summary
The answer moves with the data.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.