Question: The cell below has two corresponding lists. The list rainFallMI has the average rainfall for a month. Each element in the list months corresponds to
The cell below has two corresponding lists. The list rainFallMI has the average rainfall for a month. Each element in the list months corresponds to the value in the list rainfallMI.
Write code that does the following by iterating over the list months:
Displays the elements in the list months and rainfallMI as a two column table as shown below.
Finds the month with the largest rainfall and stores the month name in the variable maxMonth and the rainfall value in maxRain.
Finds the month with the smallest rainfall and stores the month name in the variable minMonth and the rainfall value in minRain.
Total the rainfall for the year and store the result in totRain.
Print the information as shown in expected output.
The month must printed leftjustified and the rainfall rightjustified. You may use string formatting.
Since you can only iterate over one sequence at a time, you need an alternate approach to index into the other sequence. One way is to iterate over one list and index into to other. You may solve this problem in any fashion you choose. However, you must use only one for loop.
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
