Fever

A file contains a record of the body temperatures of several patients admitted to a hospital. Each line of the file corresponds to a patient and contains the name of the patient (str) and, separated by colons (':'), a variable number of measured temperatures (float). An example of this kind of file is file patients.txt with this content:

Josefa Marquez:37.6:38.2:38.8:38.9:38.9:37.5
Joan Oliva:36.5:36.5:36.8:36.5
Peret:37.3:38.4:36.6:35.9
Josep Petit:38.2:38.1:36.5:36.8:35.9
Margarida Flor:36.7:36.9:37.5:36.2
Maria Montserrat:39.4:38.9:39.1:38.3:37.1:36.3
Lluis Perez:36.9:36.5:36.8:36.5
Puri Garcia:37.3:38.4:36.6:35.9
Joana Marques:38.2:38.1:36.5:36.8:35.9
Marga Roca:36.7:36.9:37.5:36.2

Save the following function into file fever.py.

Write the function fever() that takes the name of a file (str) with the described characteristics and a threshold (float), and returns a list with the names (str) of those patients with an average temperature strictly greater than the given threshold. Patients in this list must be in the same order as in the file. Examples:

>>> fever('patients.txt', 39.0)
[]
>>> fever('patients.txt', 37.1)
['Josefa Marquez', 'Josep Petit', 'Maria Montserrat', 'Joana Marques']

Note

More tests are provided in file test-fever.txt

Solutions

A solution of this function is provided in file fever.py