#K33677. Weather Data Processor
Weather Data Processor
Weather Data Processor
In this problem, you are given a list of weather records. Each record consists of a day of the week and a temperature in Fahrenheit. Your task is to convert the Fahrenheit temperature to Celsius using the formula: $$C = \frac{5}{9}(F - 32)$$, round the result to two decimal places, and assign a weather description based on the input temperature. Specifically, if the temperature is greater than 85°F, the day is classified as Hot; if it is between 60°F and 85°F (inclusive), as Warm; otherwise, as Cold.
You must then output a JSON formatted dictionary where each key is the day and its value is a sub-dictionary with keys "Celsius" and "Weather". If no records are provided, output an empty dictionary {}
.
inputFormat
The input is read from stdin and has the following format:
- The first line contains an integer
N
— the number of weather records. - The next
N
lines each contain a day of the week (a string without spaces) and an integer temperature in Fahrenheit, separated by a space.
outputFormat
Output a JSON formatted dictionary to stdout where each key is a day of the week and the corresponding value is a dictionary containing:
"Celsius"
: the temperature in Celsius (rounded to two decimal places)."Weather"
: a string that is "Hot" if Fahrenheit > 85, "Warm" if 60 ≤ Fahrenheit ≤ 85, or "Cold" if Fahrenheit < 60.
If there are no records, output an empty dictionary: {}
.
1
Monday 90
{"Monday": {"Celsius": 32.22, "Weather": "Hot"}}