Here's some background information on our Gregorian calendar. Although the Gregorian calendar was created in 1582, The United States did not adopt it until 1752. Therefore, the Gregorian calendar formula for calculating leap years only applies to years 1752 and later in the United States. The Gregorian calendar provided an improved formula for calculating which years are Leap Years. The criteria for a determining whether a year is a Leap Year is: Leap Year Definition: • The year is evenly divisible by 4; • If the year can be evenly divided by 100, it is NOT a leap year, unless; • The year is also evenly divisible by 400. Then it is a leap year. Your assignment is to create a Python program that in general uses a function to determine whether a year is a leap year and another function for obtaining year input values from the user. More specifically your program should: 1. Contain a function that determines whether a year passed to it is: a. A valid year for the Gregorian calendar usage in the United States, i.e. Year >=1752. b. If it is a valid year, apply the Leap Year definition to it to determine whether it is a leap year. c. Return to the calling function whether the year was invalid, a leap year, or not a leap year. d. This function should not print anything. 2. Contain a function to obtain a non-negative year (a number greater than or equal to zero). a. The function should provide the user with a way to abort the entry process. b. Handle invalid inputs. c. Return a valid number or whatever you are using to signify that the user wishes to exit the program. I suggest using a value of 0. 3. The main program should do the following. a. Create a list of years containing 1500, 1900, 2000, 2001, 2002, 2003, and 2004. b. Call your function to determine whether the years in the list are leap years and output the year and whether or not it is a leap year. If the leap year calculation was not valid for the year it should print a message to that effect. c. Have a loop to allow the user to determine whether additional years are leap years. After each year is entered, the program should indicate whether the year is a leap year. Of course, it should include a way for the user to exit the loop and end the program. d. Since the output for items 3.b and 3.c are the same, you could create an additional function to be called to print the results out for each year. Using an additional function for printing the results is an option and is not a requirement.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Here's some background information on our Gregorian calendar. Although the Gregorian
calendar was created in 1582, The United States did not adopt it until 1752. Therefore, the
Gregorian calendar formula for calculating leap years only applies to years 1752 and later in the
United States. The Gregorian calendar provided an improved formula for calculating which
years are Leap Years. The criteria for a determining whether a year is a Leap Year is:
Leap Year Definition:
• The year is evenly divisible by 4;

• If the year can be evenly divided by 100, it is NOT a leap year, unless;
• The year is also evenly divisible by 400. Then it is a leap year.
Your assignment is to create a Python program that in general uses a function to determine
whether a year is a leap year and another function for obtaining year input values from the user.
More specifically your program should:
1. Contain a function that determines whether a year passed to it is:
a. A valid year for the Gregorian calendar usage in the United States, i.e. Year
>=1752.
b. If it is a valid year, apply the Leap Year definition to it to determine whether it is
a leap year.
c. Return to the calling function whether the year was invalid, a leap year, or not a
leap year.
d. This function should not print anything.
2. Contain a function to obtain a non-negative year (a number greater than or equal to zero).
a. The function should provide the user with a way to abort the entry process.
b. Handle invalid inputs.
c. Return a valid number or whatever you are using to signify that the user wishes to
exit the program. I suggest using a value of 0.
3. The main program should do the following.
a. Create a list of years containing 1500, 1900, 2000, 2001, 2002, 2003, and 2004.
b. Call your function to determine whether the years in the list are leap years and
output the year and whether or not it is a leap year. If the leap year calculation
was not valid for the year it should print a message to that effect.
c. Have a loop to allow the user to determine whether additional years are leap
years. After each year is entered, the program should indicate whether the year is
a leap year. Of course, it should include a way for the user to exit the loop and
end the program.
d. Since the output for items 3.b and 3.c are the same, you could create an additional
function to be called to print the results out for each year. Using an additional
function for printing the results is an option and is not a requirement.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education