easter dates spreadsheet with exact dates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VeryUnsociable
    New Member
    • Nov 2016
    • 1

    easter dates spreadsheet with exact dates

    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?
  • dwblas
    Recognized Expert Contributor
    • May 2008
    • 626

    #2
    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.

    Comment

    Working...