Skip to content

Instantly share code, notes, and snippets.

@csinchok
Created October 19, 2017 21:58
Show Gist options
  • Save csinchok/92ef7b034e410ddfbb92baab6f4c6dea to your computer and use it in GitHub Desktop.
Save csinchok/92ef7b034e410ddfbb92baab6f4c6dea to your computer and use it in GitHub Desktop.
When should we see toasty
import sys
from datetime import date, datetime
def when_should_we_go_home(toasty_birth_date):
if toasty_birth_date <= date(2017, 10, 28):
return (date(2017, 10, 29), date(2017, 10, 30))
if toasty_birth_date <= date(2017, 11, 3):
return (date(2017, 11, 4), date(2017, 11, 5))
if toasty_birth_date <= date(2017, 11, 19):
return (date(2017, 11, 15), date(2017, 11, 19))
raise NotImplementedError('Toasty came really late')
if __name__ == '__main__':
try:
toasty_birth_date = datetime.strptime(sys.argv[-1], '%m/%d/%Y').date()
except ValueError:
print('USAGE: when_should_we_go_home.py 11/01/2017')
sys.exit()
start, end = when_should_we_go_home(toasty_birth_date)
print('{:%m/%d/%Y} - {:%m/%d/%Y}'.format(start, end))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment