Answer:
#variable initialization
m = 0
Sum = 0
#accept number of years
Y = int(input("Enter number of years: "))
#validated the years are in the range 1 to 10 or not
while Y < 1 or Y > 10:
Y = int(input("Enter number of years: "))
#if year are not in the range continue loop
if Y < 1 or Y > 10:
print("Invalid years..!!!")
#loop for number of years
for i in range(Y):
#print year
print("Enter Rainfall in year", i+1," : ")
#loop for 12 times
for i in range(12):
#enter rainfall for every month
print("Enter Rainfall in month", i+1, ": ", end =' ')
V = float(input())
#calculate total rain fall
Sum = Sum + V
#calculate total month
m = m + 1
#calculate average rainfall per month
Avg = Sum/m
#display total rainfall
print("Total rainfall = ", Sum)
#display average rainfall
print("Average rainfall per month = ", Avg)
Explanation: