Skip to content

Instantly share code, notes, and snippets.

@Noleli
Created May 23, 2016 01:56
Show Gist options
  • Save Noleli/7d69e0ff373e6783dfed8f02fc11ee8e to your computer and use it in GitHub Desktop.
Save Noleli/7d69e0ff373e6783dfed8f02fc11ee8e to your computer and use it in GitHub Desktop.
Omer counter
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