Exercise 1: Write a Python program that reads from the input screen n city names and temperatures for the last 3 months for each city. And displays the following information: The city names and their...

Design a python program with comments.Exercise 1: Write a Python program that reads from the input screen n city names and<br>temperatures for the last 3 months for each city. And displays the following information:<br>The city names and their 3-month average temperature<br>The average temperature of all the cities<br>The highest temperature and its city name<br>The city names and temperatures for the cities with temperature above the average<br>temperature<br>Muscat<br>35<br>33<br>40<br>Nizwa<br>4b<br>42<br>41<br>Error: Wrong input in Nizwa<br>45<br>Sur<br>47<br>40<br>Salalah<br>28<br>39<br>20<br>17<br>Sohar 38<br>41<br>City<br>Temp Avg<br>====<br>========<br>Muscat<br>36.00<br>Sur<br>44.00<br>Salalah<br>21.67<br>Sohar<br>39.33<br>The average temperature is 35.25<br>The highest temperature is 44.00 recorded in Sur<br>Cities with temperature above the average:<br>City<br>Temp Avg<br>====<br>========<br>Muscat<br>36.00<br>Sur<br>44.00<br>Sohar<br>39.33<br>Sample run<br>Your program must define and use the following functions only:<br>1. read (): reads the city names and temperatures from the input screen and stores<br>the names and temperature averages into two lists cities and tempAvg.<br>2. findAverage():returns the average temperature of the list passed as an<br>argument.<br>3. findMaxTempPos (): returns the position of the highest temperatures in the list.<br>4. displayResults():displays the output shown in the above sample run.<br>Note:<br>All the displays should be done in displayResults()function.<br>

Extracted text: Exercise 1: Write a Python program that reads from the input screen n city names and temperatures for the last 3 months for each city. And displays the following information: The city names and their 3-month average temperature The average temperature of all the cities The highest temperature and its city name The city names and temperatures for the cities with temperature above the average temperature Muscat 35 33 40 Nizwa 4b 42 41 Error: Wrong input in Nizwa 45 Sur 47 40 Salalah 28 39 20 17 Sohar 38 41 City Temp Avg ==== ======== Muscat 36.00 Sur 44.00 Salalah 21.67 Sohar 39.33 The average temperature is 35.25 The highest temperature is 44.00 recorded in Sur Cities with temperature above the average: City Temp Avg ==== ======== Muscat 36.00 Sur 44.00 Sohar 39.33 Sample run Your program must define and use the following functions only: 1. read (): reads the city names and temperatures from the input screen and stores the names and temperature averages into two lists cities and tempAvg. 2. findAverage():returns the average temperature of the list passed as an argument. 3. findMaxTempPos (): returns the position of the highest temperatures in the list. 4. displayResults():displays the output shown in the above sample run. Note: All the displays should be done in displayResults()function.

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here