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(201 6, 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?
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(201 6, 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?
Comment