Question: Write a Python program to exercise lists. Constraints: Display any numerical output with 2 digits after the decimal point Process: Write a Python program process

Write a Python program to exercise lists.

Constraints:

Display any numerical output with 2 digits after the decimal point

Process:

Write a Python program process temperature data.

1. Ask the user for the number of months to process

2. Validate the number of months to make sure its a number between 1 and 48

3. Ask the user for the temperature data for the highest and lowest temperatures for each month and store the data in a 2-dimensional array. Note that these values can be decimal values such as 85.5, etc.

4. Validate the temperature values to be between -40 and 40 degrees

5. Store the average temperature for each month in a list

6. Store the average temperature for the highest and the lowest temperature in a list

7. Display a report that shows the temperature values along with the average temperature for the month and the average temperature for the highest and lowest temperatures

8. Find and display the highest temperature reading

9. Find and display the lowest temperature reading

10. Find and display the grand average of all temperature values

You may want to create your 2-dimensional array as:

EMPTY = 0

temp = [[EMPTY for c in range(2)] for r in range(12)]

The following table tells us that we have 3 months of temperature readings. In Month 1, the highest temperature during the month was 85 degrees and the lowest temperature was 50 degrees (a lot of fluctuations in a month!). NOTE: you are not storing the month name in the list. The following is just an example of possible data values.

Write a Python program to exercise lists. Constraints: Display any numerical output

Sample Interaction: Note that this is just a sample test case. Your code should work for any set of input. I did not show a sample run with invalid input, but you should test for invalid input.

Enter the number of months: 3

Enter the temperature values for each month

85

50

92

73

90

80

***R E P O R T***

85.00 50.00 67.50

92.00 73.00 82.50

90.00 80.00 85.00

89.00 67.67

The highest temperature reading = 92.00

The lowest temperature reading = 50.00

The grand average of all temperature values = 78.33

Month 1 Month 2 Month 3 85 92 90 50 73 80

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!