Skip to content

Instantly share code, notes, and snippets.

@dwalke44
Created September 10, 2015 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwalke44/3d50b824de04e294bf9d to your computer and use it in GitHub Desktop.
Save dwalke44/3d50b824de04e294bf9d to your computer and use it in GitHub Desktop.
Is the recycling getting picked up next week?
#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