I have following code, that will ask user each month's rainfall, and append that to rainfall_inch list, and calculate average
but i have two issues
1) after the user enters a number and next input runs, the previous entry shows behind the next input.
"Enter rainfallJanuary : 3
Enter rainfallFebruary 3 : 4"
and so on
2) problem is "'list' object cannot be interpreted as an integer" with my code.
def main():
rainfall_inch = []
name_month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
for item in name_month:
x = input()
print("Enter rainfall" + item, x, ": ", end=' ')
rainfall_inch.append(x)
b = [float(x) for x in range(rainfall_inch)]
print(b)
print("average rainfall is:", computeAverage(b))
def computeAverage(values):
#find average of rainfull
total = 0.0
for x in values:
total+=x
average = total/len(values)
return average
main()
help thank you
x = input()tox = int(input())SyntaxErroratend=" "- I hence can't reproduce your error