$9.99

assignment 9 rainfall python

I want this!

assignment 9 rainfall python

$9.99

#This program lets the user enter the total rainfall for each of 12 months into an array(list).

#The program calculates and displays the total rainfall for the year and the average monthly rainfall.

totalRainfall = 0

numMonths = 12

averageRainfall = 0

def main():

def enterRain ():

# Create a list that holds each month's rainfall

rainFall = [0] * numMonths

# Create variable to use as accumulator

rainFall = 0

# Get each month's rainfall from the user

for index in range (numMonths):

print ('Enter the rainfall for Month ', \

index +1, ':', sep='', end='')

rainFall[index] = float(input())

def rainStats (enterRain):

# Calculate the total of the list elements

for num in rainFall:

totalRainfall += num

# Calculate the average rainfall for all the months

averageRainfall = totalRainfall / numMonths

# Return the values

return averageRainfall

return totalRainfall

# Return the total rainfall and the average for the months

I want this!
Size
1.33 KB