HW3a: Gregorian Leap Years (10 Points)

Due Monday 2/24/2020

Overview

Because the length of a tropical year is actually about 365.24 days, we occasionally need leap years with 366 days to keep everything on track. The Julian calendar originally had a simple rule that a leap year occurred every 4 years, but this led to too many leap years, so the modern Gregorian calendar has slightly different rules, which are as follows:

  • Every year that is not a centennial year, but which is evenly divisible by 4, is a leap year.
  • Only centennial years which are evenly divisible by 400 are leap years. So, for instance, the year 2000 was a leap year, and 2400 will be a leap year, but 1900 was not, nor will 2100, 2200, or 2300 be.

Code To Write

You should create a new file called LeapYear.py. In this file, you should write a function is_a_leap_year(year) which takes as input a year, and which returns True if that year is a leap year or False otherwise. Please submit this file to Canvas when you are finished. Please also submit answers to the following as a comment on Canvas:

  • Did you work with a buddy on this assignment? If so, who?
  • Are you using up any grace points to buy lateness days? If so, how many?
  • Approximately how many hours it took you to finish this assignment (I will not judge you for this at all...I am simply using it to gauge if the assignments are too easy or hard)
  • Your overall impression of the assignment. Did you love it, hate it, or were you neutral? One word answers are fine, but if you have any suggestions for the future let me know.
  • Any other concerns that you have. For instance, if you have a bug that you were unable to solve but you made progress, write that here. The more you articulate the problem the more partial credit you will receive (fine to leave this blank)

Testing

Be sure to run your code on at least 4 cases that cover all of your code:

  • A non-centennial year which is not a leap year (e.g. 1997)
  • A non-centennial year which is a leap year (e.g. 2020)
  • A centennial year which is not a leap year (e.g. 1900)
  • A centennial year which is a leap year (e.g. 2400)