Skip to content

Instantly share code, notes, and snippets.

@GitRay
Created January 5, 2018 17:25
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 GitRay/7138d56fd8c4d19784c2b431941d3967 to your computer and use it in GitHub Desktop.
Save GitRay/7138d56fd8c4d19784c2b431941d3967 to your computer and use it in GitHub Desktop.
Find proximity of inauguration day to MLK
import calendar
# Martin Luther King, Jr. Day was established in 1986, so the first presidential inauguration to be affected was
# George Bush I on Jan 20, 1989. King's birthday was the 15th, but we celebrate it on the 3rd Monday of each January.
# So, to me, the interesting days would be when MLK is on the 19th, 20th, or 21st.
# Let's go until the year 2089, just to get a full 100-year period since MLK started.
start_year = 1989
end_year = 2089
mon_19_ct = 0
mon_20_ct = 0
mon_21_ct = 0
total_i_days = 0
for year in range(start_year,end_year,4):
# increment the total number of inauguration days
total_i_days += 1
# Check for interesting Mondays
if calendar.weekday(year, 1, 19) == 0:
# Must be a monday
print 'Jan 19,', year
mon_19_ct += 1
if calendar.weekday(year, 1, 20) == 0:
# Must be a monday
print 'Jan 20,', year
mon_20_ct += 1
if calendar.weekday(year, 1, 21) == 0:
# Must be a monday
print 'Jan 21,', year
mon_21_ct += 1
print "------------"
print " TOTALS "
print "------------"
print "19:", mon_19_ct
print "20:", mon_20_ct
print "21:", mon_21_ct
print "Inaugurations:", total_i_days
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment