The bold portion is what I'm having issues with. I'm trying to sum all of the values entered by a user for every month, but I keep getting an error even when I rewrite it? (Shown at the bottom)
import statistics
months = ["January ","February ","March ", "April ", "May ","June ",
"July ","August ","September ","October ","November ",
"December "]
rainfall = []
for i in range( len(months) ):
val = input("Enter the amount of rainfall for the month of " + months[i] +
"(in inches): ")
rainfall.append(float(val))
**print("Total amount of rainfall for the year: ", sum(rainfall))**
print("Average monthly rainfall: ", statistics.mean(rainfall))
print("The minimum amount of rainfall is ", min(rainfall), ", recorded in",
months[rainfall.index(min(rainfall))])
print("The maximum amount of rainfall is ", max(rainfall), ", recorded in",
months[rainfall.index(max(rainfall))])
Error Message:
File "/Users/Emily/Documents/Intro Python 2020/In Class Activity 5 - P1.py", line 32, in <module>
print("Total amount of rainfall for the year: ", sum(rainfall))
TypeError: 'float' object is not callable