In: Computer Science
In python design a simple program that lets the user enter the total rainfall for each of the last 10 years into an array. The program should calculate and display the total rainfall for the decade, the average yearly rainfall, and the years with the highest and lowest amounts. Have screenshot with indentation and output display with explantion.Include comments
def RainFall(): years=["Year 1","Year 2","Year 3","Year 4","Year 5","Year 6","Year 7","Year 8","Year 9","Year 10"] rainfall=[0]*len(years) for i in range(len(years)): rainfall[i]=int(input("Enter Total Rain in "+years[i]+" ")) print("Total Rainfall:",sum(rainfall)) print("Average Rainfall:", sum(rainfall)/len(rainfall)) print(str(years[rainfall.index(min(rainfall))]),"has the lowest rainfall:",min(rainfall)) print(str(years[rainfall.index(max(rainfall))]), "has the highest rainfall:",max(rainfall)) RainFall()