Created
May 23, 2016 01:56
-
-
Save Noleli/7d69e0ff373e6783dfed8f02fc11ee8e to your computer and use it in GitHub Desktop.
Omer counter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import datetime | |
pesach = datetime.date(2016,4,22) | |
today = datetime.date.today() | |
totaldays = (today - pesach).days | |
weeks = int(math.floor(totaldays/7.0)) | |
days = totaldays % 7 | |
def pl(i): | |
if i == 1: return '' | |
else: return 's' | |
if weeks > 0: | |
outstring = 'Today is {} day{}, which is {} week{} and {} day{} of the Omer.'.format(totaldays, pl(totaldays), weeks, pl(weeks), days, pl(days)) | |
else: | |
outstring = 'Today is {} day{} of the Omer.'.format(totaldays, pl(totaldays)) | |
print outstring |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment