NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

# This program calculates total precipitation, average precipitation, and which months have the highest and lowest precipitation



#Defining Functions
def totalRain():
n = sum(rainAmtList)
return n

def average():
findAvgRain = totalRain() / 12.0
return findAvgRain

def highest():
maxMonth = max(rainAmtList)
return maxMonth

def lowest():
minMonth = min(rainAmtList)
return minMonth

def findHighestMonth():
locationInRainAmtList = rainAmtList.index(highest())
locationInMonthList = monthList[locationInRainAmtList]
return locationInMonthList

def findLowestMonth():
locationInRainAmtList = rainAmtList.index(lowest())
locationInMonthList = monthList[locationInRainAmtList]
return locationInMonthList



#Making lists for rain amounts and months
rainAmtList = []
monthList = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]



#Getting float inputs for the total precipitation for each month and appending the amounts to rainAmtList
january = rainAmtList.append(float(input("Enter total precipitation for January:n")))
february = rainAmtList.append(float(input("Enter total precipitation for February:n")))
march = rainAmtList.append(float(input("Enter total precipitation for March:n")))
april = rainAmtList.append(float(input("Enter total precipitation for April:n")))
may = rainAmtList.append(float(input("Enter total precipitation for May:n")))
june = rainAmtList.append(float(input("Enter total precipitation for June:n")))
july = rainAmtList.append(float(input("Enter total precipitation for July:n")))
august = rainAmtList.append(float(input("Enter total precipitation for August:n")))
september = rainAmtList.append(float(input("Enter total precipitation for September:n")))
october = rainAmtList.append(float(input("Enter total precipitation for October:n")))
november = rainAmtList.append(float(input("Enter total precipitation for November:n")))
december = rainAmtList.append(float(input("Enter total precipitation for December:n")))



#Printing out results by calling (and rounding if needed) the functions created earlier
print("Total precipitation: %.2f inches." %totalRain())
print("Average precipitation: %.2f inches." %average())
print(findHighestMonth(), "has the highest precipitation: %.2f inches." %highest())
print(findLowestMonth(), "has the lowest precipitation: %.2f inches." %lowest())
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.