Commit 4ed1a6e9 authored by josd's avatar josd

added

parent 0e91a905
from datetime import date
def calc_easter(year):
"Returns Easter as a date object."
"see http://code.activestate.com/recipes/576517-calculate-easter-western-given-a-year/"
a = year % 19
b = year // 100
c = year % 100
d = (19 * a + b - b // 4 - ((b - (b + 8) // 25 + 1) // 3) + 15) % 30
e = (32 + 2 * (b % 4) + 2 * (c // 4) - d - (c % 4)) % 7
f = d + e - 7 * ((a + 11 * d + 22 * e) // 451) + 114
month = f // 31
day = f % 31 + 1
return date(year, month, day)
print(calc_easter(2019))
print(calc_easter(2020))
print(calc_easter(2021))
print(calc_easter(2022))
print(calc_easter(2023))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment