Easter Sunday

In this program you will compute the date of Easter Sunday. Easter Sunday is the first Sunday after the first full moon of Spring. This algorithm was invented by Carl Friedrich Gauss. In this algorithm, all divisions are integer divisions.
  1. Let y be the year ( such as 2001 ).

  2. Divide y by 19 and call the remainder a. Ignore the quotient.

  3. Divide y by 100 to get a quotient b and a remainder c.

  4. Divide b by 4 to get a quotient d and a remainder e.

  5. Divide 8 * b + 13 by 25 to get a quotient g. Ignore the remainder.

  6. Divide 19 * a + b - d - g + 15 by 30 to get a remainder h. Ignore the quotient.

  7. Divide c by 4 to get a quotient j and a remainder k.

  8. Divide a + 11 * h by 319 to get a quotient m. Ignore the remainder.

  9. Divide 2 * e + 2 * j - k - h + m + 32 by 7 to get a remainder r. Ignore the quotient.

  10. Divide h - m + r + 90 by 25 to get a quotient n. Ignore the remainder.

  11. Divide h - m + r + n + 19 by 32 to get a remainder p. Ignore the quotient.

Easter Sunday falls on day p of the month n. For example if y is 2001: Hence in 2001, Easter Sunday was on 15 April.

Your output will look like this:

In 2001 Easter Sunday is on 15 April

You can go to the US Census Bureau website and check your result:

The program that you will be writing will be called EasterSunday. We will be looking at good documentation, and adherence to the coding convention discussed in class. You may use the same variable names used in the problem statement. Your file EasterSunday.py will have the following header:


#  File: EasterSunday.py

#  Description:

#  Student Name:

#  Date Created:

#  Date Last Modified:

import sys

def main():
  # read the year
  y = sys.stdin.readline()
  y = y.strip()
  y = int (y)


if __name__ == "__main__":
  main()

You will read your data from a text file called easter.in from stdin on the command line.

On Mac or Linux:

python3 EasterSunday.py < easter.in

On Windows:

python EasterSunday.py < easter.in