Created
October 19, 2017 21:58
-
-
Save csinchok/92ef7b034e410ddfbb92baab6f4c6dea to your computer and use it in GitHub Desktop.
When should we see toasty
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 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