Ignore the Dropouts

Data with PythonMedium+10 XP+10

Ignore the Dropouts

A soil sensor sometimes loses its signal. When it does, it doesn't skip the reading. It writes a special marker number instead, like -999.

Task: write true_average(readings, missing). missing is the marker number. Return the average of the readings that are not equal to missing, rounded to 2 decimal places.

If every reading is the marker, there's nothing to average. Return None.

There is always at least one reading.

Examples

readings = [21.5, -999, 22.0, 23.5, -999]
missing = -999
returns 22.33
readings = [-1, -1, -1]
missing = -1
returns None

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run