Created
September 10, 2015 15:34
-
-
Save dwalke44/3d50b824de04e294bf9d to your computer and use it in GitHub Desktop.
Is the recycling getting picked up next week?
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
#Determine if nearest Monday is recycling day | |
#Recycling is picked up every other Monday | |
#Dan Walker - 9 September 2015 - written in Python v. 2.7.3 | |
import datetime | |
now = datetime.datetime.now() | |
ref_date = datetime.datetime(2015, 8, 31) #A day that recycling was picked up | |
days_since_ref = now - ref_date | |
days = days_since_ref.days | |
weeks_since_ref = days/7 | |
days_into_week2 = days % 7 | |
if weeks_since_ref % 2 == 0: | |
print 'The recycling will be picked up next Monday.' | |
else: | |
print 'The recycling will be picked up this Monday.' | |
#if weeks_since_ref % 2 != 0: | |
print 'The recylcing will be picked up this coming Monday.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment