Question: 9 . Implement reports _ above _ temp Read the specification of the function reports _ above _ temp in the module funcs. This function
Implement reportsabovetemp
Read the specification of the function reportsabovetemp in the module funcs. This function does not need to read the file weather.json. All of the necessary information is passed to the parameter weather.
Implement this function according to its specification. While this is a complicated dictionary, the function follows a straightforward accumulator pattern. However, there are two challenges you should be aware of all. First of all, not every weather report contains a temperature measurement. In addition, some measurements are in Fahrenheit and others are Celsius. That is why we have provided the function tocelsius as a helper.
def reportsabovetempweathertemp:
Returns the number of weather reports where temperature is above temp in Celsius
The parameter weather contains a weather report dictionary. This function loops
through the weather reports and counts all reports for which
the report has a temperature measurement not all reports do
the measured temperature is properly above temp in Celsius
A temperature measurement is itself a dictionary with two keys: 'value' and 'units'.
For example:
"temperature":
"value":
"units": F
The units are always either F for fahrenheit or C for celsius. If the
measurement is in fahrenheit, the value will need to be converted before it
can be compared to temp.
Parameter weather: the weather dictionary
Precondition: weather has the format described in the module introduction
Parameter temp: the temperature in celsius
Precondition: temp is a float
pass
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
