Advertisement
Graham_B

Average and mins

Feb 15th, 2019
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. # average and daily rainfall for days in month
  2. # this is a manual data input. Randon numbers could be used instead by importing random.
  3. days = [] # set day count to zero
  4.  
  5. days = input("How many days in month ") #set day count to days in month or required number, shorter or longer
  6. days = int(days) #convert to integer
  7.  
  8. rainfalls = [] #set rainfall data to zero
  9.  
  10. # enter the data for each day it rains and have data stored in a index list, convert to integer and store in rainfall.
  11. for rain in range(days):
  12. rain = int(input("Lets enter the day rainfall " + "?"))
  13. rainfalls.append(rain)
  14. #output data in list for daily and averaged records.
  15. print(rainfalls)
  16. print("Total of rainfall in month is :", sum(rainfalls))
  17. print("Average rainfall for month is :", sum(rainfalls)/days)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement