Мы должны сделать так, чтобы пользователь мог вносить общее количество осадков за каждые 12 месяцев в список. Программа должна рассчитать и отобразить общее количество осадков за год, среднемесячное количество осадков
. Проблема: максимальное значение отлично, но минимальное значение застряло в 0
код:
Rainfall=[0]*13
i=1
total=0
print("Enter the Rainfall each month")
while i<=12:
print('Month #',i, ': ',end=' ')
Rainfall[i]=float(input())
total+=Rainfall[i]
i+=1
ave=total/12
High = max (Rainfall)
Low = min(Rainfall)
print("total Amount= ",total)
print("Average Average Amount {:0.2f}".format(ave))
print ("The months with the highest value are : ")
print ([i for i, j in enumerate(Rainfall) if j == High])
print ("The months with the Lowest value are : ")
print ([i for i, j in enumerate(Rainfall) if j == Low])
output:Enter the Rainfall each month
Month # 1 : 1
Month # 2 : 1
Month # 3 : 399
Month # 4 : 900
Month # 5 : 900
Month # 6 : 900
Month # 7 : 900
Month # 8 : 2323
Month # 9 : 42
Month # 10 : 100
Month # 11 : 10000
Month # 12 : 10000
total Amount= 26466.0
Average Average Amount 2205.50
The months with the highest value are :
[11, 12]
The months with the Lowest value are :
[0]
Process finished with exit code 0