Directions: Write a code for the following programming exercise in PYTHON!!!!!!!
-Design a program that lets the user enter the total rainfall for each of 12 months into a list. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts.
Here is what i got so far, but for some reason this code only print the Minimum and Maximum. its not printing the Average.
def main():
lst = []
x=0
rain = [0,0,0,0,0,0,0,0,0,0,0,0]
Month = [ 'January', 'February', 'March', 'April', 'May', 'June',
'July','August','September', 'October',
'November','December']
print("Enter the amount of rain for ",Month[x])
rain[x] = float(input("Enter the amount of rain: "))
for x in range(12):
lst.append(eval(input()))
highest = lst[0]
lowest = lst[0]
avg = 0
total = 0
for y in lst:
if(highest < y):
highest = y
if(lowest > y):
lowest = y
total+=rain[x]
avg = total/12
print("Maximum =",highest)
print("Minimum =",lowest)
print("Average =",avg)
main()
Code:
def main():
rain = []
Month = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July','August','September', 'October', 'November','December']
for x in range(12):
print("Enter the amount of rain for ",Month[x])
r = float(input("Enter the amount of rain: "))
rain.append(r)
highest = rain[0]
lowest = rain[0]
for y in rain:
if(highest < y):
highest = y
if(lowest > y):
lowest = y
avg = sum(rain)/12
print("Total rainfall for the year =",sum(rain))
print("Maximum =",highest)
print("Minimum =",lowest)
print("Average =",avg)
main()
Output:

Directions: Write a code for the following programming exercise in PYTHON!!!!!!! -Design a program that lets...
Can anyone explain this code line by line, what it is, what is it doing? lst = [] print("Enter 10 numbers: ") #flag indication if a specfic condition exist flag = False # for x in range(10): num = eval(input()) if(num >= 100): flag = True lst.append(num) if(flag): print("Warning: value over 100 has been entered.") maxVal = lst[0] minVal = lst[0] total = 0 avg = 0 for y in lst: if(maxVal < y): maxVal = y if(minVal > y):...
Design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amount. PLEASE MODULARIZED THE CODE PLEASE USE C PROGRAMMING AND ADD PSEUDOCODE
Write a program in C++ that lets the user enter the total rainfall for each of 12 months into an array of doubles. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Input validation: Do not accept negative numbers for monthly rainfall figures.
The Problem Design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall, the number of months above and below the average rainfall, and the highest rainfall for each quarter of the year. The Assignment Write a Java program that contains five method/functions as follows: main(). Calls the functions enterRain, rainStats, aboveBelow, and quarterlyRain. enterRain(). Uses...
pseudocode and Python Repl.it :Recall that Programming Exercise 3 in Chapter 8 asked you to design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Enhance the program so it sorts the array in ascending order and displays the values it contains.
qbasic is the programming language
Chapter 8 Do Programming Exercise 8-3 om page 414. Create a string array to hold the months of the year. Call it anything you want to just make sure it's a string array is at the end of the name, e.g. months). Create a DATA statement that holds the month names: DATA "jan","Feb", "Mar" etc. Next you'll need a FOR loop to READ the DATA into the array, Call a SUB to get the rainfall...
Write a python program where you create a list (you an create it in code you do not have to use input() statements) that represents the total rainfall for each of 12 months (assume that element 0 is January and element 11 is December). The program should calculate and display the: 1) total rainfall for the year; 2) the average monthly rainfall; 3) the months with the highest and lowest amounts. You need to figure out how to access each...
Rainfall StatisticsWrite a modular program that analyzes a year's worth of rainfall data. In addition to main, the program should have a getData function that accepts the total rainfallfor each of 12 months from the user, and stores it in a double array. It should also have four value-returning functions that compute and return to main thetotalRainfall, averageRainfall, driestRainfall, and wettestMonth. These last two functions return the number of the month with the lowest and highest rainfall amounts,not the amount...
Write a program that lets the user enter the total amount of money spent on a credit card for each of 12 months into an array of doubles. The program should calculate and display the total amount of money spent for the year, the average monthly spent, and the months with the highest and lowest amounts. Input Validation: Do not accept negative numbers for monthly credit card charges. If the credit card charge for the month is negative, assume the...
Rainfall Statistics Write a program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles. The program should calculate and display (in this order): the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Months should be expressed as English names for months in the Gregorian calendar, i.e.: January, February, March, April, May, June, July, August, September, October, November, December....