473,548 Members | 2,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

easter dates spreadsheet with exact dates

1 New Member
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?
Nov 2 '16 #1
1 1126
dwblas
626 Recognized Expert Contributor
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
12806
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 2003-11-19
2
3379
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 american scientific issue, march 2001. The article about the calendars is very interesting. Have fun... --
8
14961
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 format like: '2005-01-01', '2005-01-02',... Any ideas? thanks
9
1322
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 display events that are today or in the future. I need help! Dim tmpEvents As Events tmpEvents = New EventsMapper().GetEvents() Dim tmpEvent As...
0
1182
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 process a single record, when I proceed to print it, it prints the first page containing the processed record. It also prints 5 more blank pages without...
1
1777
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 => 08:00:00
4
35775
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 get a list dates = ?
2
3392
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 '10-05-2010', '12-05-2010', '14-05-2010', '17-05-2010', '19-05-2010', '21-05-2010', '24-05-2010'.
16
4304
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 Vaclist.EmpID FROM Vaclist WHERE (((Vaclist.VacDate) Between And ))
0
7518
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7711
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7954
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7805
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6039
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5085
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3497
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.