473,320 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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(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
1 1115
dwblas
626 Expert 512MB
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

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

Similar topics

7
by: Bambero | last post by:
Hello all Problem like in subject. There is no problem when I want to count days between two dates. Problem is when I want to count years becouse of leap years. For ex. between 2002-11-19...
2
by: Gustavo G. Rondina | last post by:
It is possible to caclulate every year's easter using simple mathematical operations. Here is a code that does the trick: http://www.brlivre.org/c/easter.c I found the math scheme in an...
8
by: Notgiven | last post by:
Say you have two dates, 2005-01-01 and 2005-01-24. I want to get a list or array or all the date between and including those two dates. I want to include this list in a query so I need it in a...
9
by: labelle | last post by:
I have an event listing on my website that is pulling from SQL. Unfortunately, the listing is displaying all events, especially those that are even 2 years old. I want to get rid of them and only...
0
by: GiftX | last post by:
Hellow everyone, I am calling/manipulating Excel spreadsheet through VB 6.0. Most of my objectives are accomplished except some cosmetics. Problem#1: For example, after running my program to...
1
by: kigoobe | last post by:
Well guys, I am storing data in the mysql which when extracted gives this - Array ( => Array ( => 26 => 2007-11-01 => 16:01:00 ...
4
by: Charlote | last post by:
Hello, I am a beginner in python, and have a question.. I need to create a list of all dates between two dates.. Lets say beggining date= 2008-1-15 enddate= 2008-2-20 how do I...
2
by: khaing | last post by:
How can I get the dates between two dates depending on days? For example, if I give the start date '10-05-2010' and end date '24-05-2010' and days are Mon, Wed, Fri , the result should be...
16
by: Projectnow | last post by:
hi, I need to view all dates between two dates parameters in the crosstab query headings where I use this syntax PARAMETERS d DateTime, b DateTime; TRANSFORM Sum(Vaclist.Period) AS S SELECT...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.