Loading...

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
senior

Problem

The IoT pipeline receives sensor readings tagged with a key, and the dashboard needs running averages per sensor at any point in the stream. Build a class with add(key, value) to record a reading and get_averages() to return a dict mapping each key to its current mean value.

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.