0 Hot A> 25 L>0 Warm 20 2A2 25 L>0 H< 40="" nice="" l="">0 H< 40="" cold="">< 20="">< 40="" freezing="" extreme="" ls0="" otherwise="" for="" example,="" if="" the="" average="" temperature="" is="" 21="" and="" it="" always="" stays="" between="" 0="" and="" 40="" during="" the="" day,="" then="" the="" weather="" condition="" is="" nice.="" (hint:="" study="" the="" table="" carefully="" and="" think="" of="" the="" best="" approach="" to="" find="" the="" condition.="" this="" will="" save="" your="" coding="" time="" later).="" you="" program="" must="" be="" well-documented="" and="" work="" for="" any="" number="" of="" cities="" in="" general.="" all="" file="" access="" (reading="" and="" writing)="" must="" be="" done="" in="" the="" main="" function.="" both="" functions="" should="" be="" optimized="" (using="" loops="" and="" lists="" to="" reduce="" the="" number="" of="" lines="" whenever="" possible).="" sample="" of="" input="" file:="" temperature.txt="" (you="" can="" copy/paste="" and="" save="" below="" data="" as="" text="" file="" for="" input)="" makkah="" almadina="" riyadh="" jeddah="" 33.3="" 30.1="" 35="" 20.5="" 30="" 15="" 44.9="" 41.5="" 38="" 40="" 40="" 30="" 35="" 35="" 25="" 16="" 8.5="" 15="" -4="" 27="" 20="" 17="" 20="" 1="" 35="" 30="" 25="" 25="" 3.5="" 32="" 32="" 21="" 23="" 7="" 29="" 22="" 16="" 21.5="" 1.2="" dammam="" abha="" alhada="" tabouk="" "/="">
Extracted text: Write a Python program that analyses temperature information of some cities given in an input file named "temperature.txt". The program outputs a "WeatherReport.txt" which contains a table summarizing the data where each city is listed with its low, high, and average temperatures, and its weather condition {Hot, Warm, Nice, Cold, Freezing, Extreme}. Each line in the input file contains the city name, followed by 5 temperature readings taken during the day. Samples of input and output files are given below. text file named Requirements: The program must have at least 2 functions: 1. The main function: It reads the data from the input file, stores it in a list, then displays the data in a table with the weather condition for each city. It must call the function weatherCondition to find the condition. It may also call other functions if needed. 2. The weatherCondition(low, high, average) function: It takes three parameters (low, high, and average temperatures), and returns the condition of the weather as a string according to the following table: Temperature Low (L) Weather Average (A) High (H) Η 240 H< 40="" condition="" l="">0 Hot A> 25 L>0 Warm 20 2A2 25 L>0 H< 40="" nice="" l="">0 H< 40="" cold="">< 20="">< 40 freezing extreme ls0 otherwise for example, if the average temperature is 21 and it always stays between 0 and 40 during the day, then the weather condition is nice. (hint: study the table carefully and think of the best approach to find the condition. this will save your coding time later). you program must be well-documented and work for any number of cities in general. all file access (reading and writing) must be done in the main function. both functions should be optimized (using loops and lists to reduce the number of lines whenever possible). sample of input file: temperature.txt (you can copy/paste and save below data as text file for input) makkah almadina riyadh jeddah 33.3 30.1 35 20.5 30 15 44.9 41.5 38 40 40 30 35 35 25 16 8.5 15 -4 27 20 17 20 1 35 30 25 25 3.5 32 32 21 23 7 29 22 16 21.5 1.2 dammam abha alhada tabouk 40="" freezing="" extreme="" ls0="" otherwise="" for="" example,="" if="" the="" average="" temperature="" is="" 21="" and="" it="" always="" stays="" between="" 0="" and="" 40="" during="" the="" day,="" then="" the="" weather="" condition="" is="" nice.="" (hint:="" study="" the="" table="" carefully="" and="" think="" of="" the="" best="" approach="" to="" find="" the="" condition.="" this="" will="" save="" your="" coding="" time="" later).="" you="" program="" must="" be="" well-documented="" and="" work="" for="" any="" number="" of="" cities="" in="" general.="" all="" file="" access="" (reading="" and="" writing)="" must="" be="" done="" in="" the="" main="" function.="" both="" functions="" should="" be="" optimized="" (using="" loops="" and="" lists="" to="" reduce="" the="" number="" of="" lines="" whenever="" possible).="" sample="" of="" input="" file:="" temperature.txt="" (you="" can="" copy/paste="" and="" save="" below="" data="" as="" text="" file="" for="" input)="" makkah="" almadina="" riyadh="" jeddah="" 33.3="" 30.1="" 35="" 20.5="" 30="" 15="" 44.9="" 41.5="" 38="" 40="" 40="" 30="" 35="" 35="" 25="" 16="" 8.5="" 15="" -4="" 27="" 20="" 17="" 20="" 1="" 35="" 30="" 25="" 25="" 3.5="" 32="" 32="" 21="" 23="" 7="" 29="" 22="" 16="" 21.5="" 1.2="" dammam="" abha="" alhada=""> 40 freezing extreme ls0 otherwise for example, if the average temperature is 21 and it always stays between 0 and 40 during the day, then the weather condition is nice. (hint: study the table carefully and think of the best approach to find the condition. this will save your coding time later). you program must be well-documented and work for any number of cities in general. all file access (reading and writing) must be done in the main function. both functions should be optimized (using loops and lists to reduce the number of lines whenever possible). sample of input file: temperature.txt (you can copy/paste and save below data as text file for input) makkah almadina riyadh jeddah 33.3 30.1 35 20.5 30 15 44.9 41.5 38 40 40 30 35 35 25 16 8.5 15 -4 27 20 17 20 1 35 30 25 25 3.5 32 32 21 23 7 29 22 16 21.5 1.2 dammam abha alhada tabouk>