Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # average and daily rainfall for days in month
- # this is a manual data input. Randon numbers could be used instead by importing random.
- days = [] # set day count to zero
- days = input("How many days in month ") #set day count to days in month or required number, shorter or longer
- days = int(days) #convert to integer
- rainfalls = [] #set rainfall data to zero
- # enter the data for each day it rains and have data stored in a index list, convert to integer and store in rainfall.
- for rain in range(days):
- rain = int(input("Lets enter the day rainfall " + "?"))
- rainfalls.append(rain)
- #output data in list for daily and averaged records.
- print(rainfalls)
- print("Total of rainfall in month is :", sum(rainfalls))
- print("Average rainfall for month is :", sum(rainfalls)/days)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement