By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 1,077 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

easter dates spreadsheet with exact dates

P: 1
hi, I recently started to study python and have a problem
I need to create a spreadsheet for the easter date between 2016 and 2020. The first half of the problem was to give out the exact date. I finished it
it looks like this:

def easter(year):
A = year%19
K = year//100
M = 15+(3*K+3)//4-(8*K+13)//25
D = (19*A+M)%30
S = 2-(3*K+3)//4
R = D//29+(D//28-D//29)*(A//11)
OG = 21+D+R
SZ = 7-(year+year//4+S)%7
OE = 7-(OG-SZ)%7
OS = (OG+OE)
if OS>31:
return("april " +str(OS-31).zfill(2))
else:
return("march " +str(OS))


now I need to create a function the gives out the following:

>>> printeaster(2016, 2020)

year day
-----------
2016 march 27
2017 april 16
2018 april 01
2019 april 21
2020 april 12

What would be the simplest way to solve this?
Nov 2 '16 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 613
printeaster() would call easter() for each year and then print the result. Easter is lunar holiday, and so follows the first full moon of spring. There is no way to tell from the meaningless variable names (where did you copy this code from, and please drop the author a note saying meaningful variable names would help) whether the program functions correctly or not so I will take your word for it.
Nov 3 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.