Temperature analysis (3 points)¶
Now, to analyze the temperature at different points in the production
center, the same company has obtained a nested list in which each
sublist has three items: point code (str), temperature
(int) and humidity (int). The
temperature and humidity are always positive integers.
Write function temperature() that takes a nested list as
described, and returns a tuple with two elements:
It may be assumed that the given list is not empty.
Save this function to file p2.py.
Examples:
>>> lt1 = [['AX1', 43, 67], ['AX2', 56, 45], ['BT3', 62, 89], ['GH5', 59, 74]]
>>> (a, b) = temperature(lt1)
>>> (round(a, 1), b)
(55.0, 'BT3')
>>> lt2 = [['AX1', 44, 67], ['AX2', 51, 45], ['BT3', 62, 89], ['GH5', 56, 74], ['TR5', 54, 55]]
>>> (a, b) = temperature(lt2)
>>> (round(a, 1), b)
(53.4, 'BT3')
Note
More tests are provided in file test-temperature.txt.