Question: This needs to be coded in python. Write a function that returns the number of days in a year using the following header: def numberOfDaysInAYear(year):

This needs to be coded in python.This needs to be coded in python. Write a function that returnsthe number of days in a year using the following header: defnumberOfDaysInAYear(year): Write a main function that displays the number of days in

Write a function that returns the number of days in a year using the following header: def numberOfDaysInAYear(year): Write a main function that displays the number of days in the years from 2000 to 2010 Hint: in a non-leap year, there are 365 days, in a leap year there are 366 days. A year is a leap if it is divisible by 400 or divisible by 4 but not divisible by 100 . Here is a sample run: 2000 has 366 2001 has 365 2002 has 365 2003 has 365 2004 has 366 2005 has 365 2006 has 365 2007 has 365 2008 has 366 2009 has 365 2010 has 365 Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period. Use for loops. Round all values to two decimal places. Here a sample run: Enter the number of years: 2 For year 1 : Enter the rainfall amount for the month 1:1.2 Enter the rainfall amount for the month 2:1.5 Enter the rainfall amount for the month 3:1.9 Enter the rainfall amount for the month 4:2.0 Enter the rainfall amount for the month 5:2.2 Enter the rainfall amount for the month 6:2.5 Enter the rainfall amount for the month 7:1.4 Enter the rainfall amount for the month 8:1.8 Enter the rainfall amount for the month 9:2.3 Enter the rainfall amount for the month 10:1.9 Enter the rainfall amount for the month 11:1.8 Enter the rainfall amount for the month 12:1.0 For year 2 : Enter the rainfall amount for the month 1:2.0 Enter the rainfall amount for the month 2:2.1 Enter the rainfall amount for the month 3:1.1 Enter the rainfall amount for the month 4:1.2 Enter the rainfall amount for the month 5:1.6 Enter the rainfall amount for the month 6:2.7 Enter the rainfall amount for the month 7:2.4 Enter the rainfall amount for the month 8:1.9 Enter the rainfall amount for the month 9:1.2 Enter the number of years: 2 For year 1 : Enter the rainfall amount for the month 1: 1.2 Enter the rainfall amount for the month 2:1.5 Enter the rainfall amount for the month 3: 1.9 Enter the rainfall amount for the month 4:2.0 Enter the rainfall amount for the month 5: 2.2 Enter the rainfall amount for the month 6:2.5 Enter the rainfall amount for the month 7:1.4 Enter the rainfall amount for the month 8:1.8 Enter the rainfall amount for the month 9:2.3 Enter the rainfall amount for the month 10:1.9 Enter the rainfall amount for the month 11:1.8 Enter the rainfall amount for the month 12:1.0 For year 2 : Enter the rainfall amount for the month 1: 2.0 Enter the rainfall amount for the month 2:2.1 Enter the rainfall amount for the month 3:1.1 Enter the rainfall amount for the month 4:1.2 Enter the rainfall amount for the month 5: 1.6 Enter the rainfall amount for the month 6:2.7 Enter the rainfall amount for the month 7:2.4 Enter the rainfall amount for the month 8:1.9 Enter the rainfall amount for the month 9: 1.2 Enter the rainfall amount for the month 10:2.0 Enter the rainfall amount for the month 11: 2.8 Enter the rainfall amount for the month 12:2.9 For 24 months Total rainfall: 45.40 inches Average monthly rainfall: 1.89 inches

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!