The previous chapter classified available readings, skipped missing ones, and carried a total and count to a final mean. Copying that complete calculation for every new dataset would repeat several connected instructions and create several places to repair.
We will first move the familiar code into a named function without changing its calculation. Then the caller will pass readings into `mean(readings)` and receive a result. Tracing two calls will show that each one begins with fresh local work and returns only the value the caller needs.
The completed program will format an available mean or report that it is unavailable. Small tests will check ordinary, one-reading, empty, and all-missing cases against answers worked out independently. Clear names and docstrings will finish the interface before the next chapter develops richer work with ordered values.