#Using Lists/Arrays

TotalRainfall = 0.0

#Create the array
Rainfall = []

#For loop to populate the array with five measurements of rainfall
for Counter in range (0, 5, 1):
    RainMeasurement = float(input("Please enter the measurement of rainfall in millimetres: ")) #Receive input from user of the measurements of rainfall to put into the array

    #Range check to ensure that a number that is 0 or more is entered - 0 is a valid value if there is no rainfall
    while (RainMeasurement < 0):
        if(RainMeasurement < 0):
            print("Invalid rainfall entered! Please enter a number that is 0 or more")
            print(" ")
            RainMeasurement = float(input("Please enter the measurement of rainfall in millimetres: "))
        
    Rainfall.append(RainMeasurement) #Adds each measurement of rain to the array
    TotalRainfall = TotalRainfall + RainMeasurement #Calculates the total rainfall as the loop collects values


print(" ")

print("Rainfall Measurements:")

#For loop prints each rainfall measurement to the user
for Counter in range (0, len(Rainfall), 1):
    print(Rainfall[Counter], end=" ")
    print("")


#Calculates the average rainfall
AverageRainfall = TotalRainfall / 5


#Outputs the total and average rainfall to the user
print(" ")
print("The total rainfall is " + str(TotalRainfall))
print("The average rainfall is " + str(AverageRainfall))
