Hi Rosika,
I certainly will give it a try.
It looks neater than my messy bash script. Well done.
Keep going with Python
My first attempt failed
$ python3 easter_check.py
Traceback (most recent call last):
File "/home/nevj/easter_check.py", line 2, in <module>
from orthodox.easter import orthodox_easter
ModuleNotFoundError: No module named 'orthodox'
I think there is something missing from my Python environment.
My Python learning curve starts here.
Update:
It seems it is a Python2 vs Python3 problem.
Your ChatGPT info is , I think Python2
The Python3 equivalent is here
so I modified your code accordingly
from dateutil.easter import easter
# Define the range of years to check
start_year = 2025
end_year = 2100
print("Years when Western and Orthodox Easter fall on the same date:\n")
for year in range(start_year, end_year + 1):
western = easter(year,method=3)
orthodox = easter(year,method=2)
if western == orthodox:
print(f"{year}: Easter = {western.strftime('%d/%m/%Y')}")
Now it works
$ python3 easter_check.py
Years when Western and Orthodox Easter fall on the same date:
2025: Easter = 20/04/2025
2028: Easter = 16/04/2028
2031: Easter = 13/04/2031
2034: Easter = 09/04/2034
2037: Easter = 05/04/2037
2038: Easter = 25/04/2038
2041: Easter = 21/04/2041
2045: Easter = 09/04/2045
2048: Easter = 05/04/2048
2052: Easter = 21/04/2052
2055: Easter = 18/04/2055
2058: Easter = 14/04/2058
2061: Easter = 10/04/2061
2069: Easter = 14/04/2069
2071: Easter = 19/04/2071
2072: Easter = 10/04/2072
2075: Easter = 07/04/2075
2079: Easter = 23/04/2079
2082: Easter = 19/04/2082
2085: Easter = 15/04/2085
2091: Easter = 08/04/2091
2095: Easter = 24/04/2095
2096: Easter = 15/04/2096
2099: Easter = 12/04/2099
The same result as my messy script.
It looks like Python handles dates better than bash
Maybe the Python experts can help us with this
- how do I look up which package supplies a given function
- is there a list of Python libraries with a summary of their content
- where is the information on how to use the functions in a given library
So Rosika, do you have Python2 or Python3?
That would seem to be critical.
Regards
Neville
Update:
My Devuan is Python2
I tried that
nevj@trinity:~$ python
Python 2.7.18 (default, Sep 19 2023, 07:10:59)
[GCC 10.2.1 20210110] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from dateutil.easter import easter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named dateutil.easter
So, no it is not a Python2 issue… my bad guess.