A Little Python Makes Dad Happy

My daughter, Jessica was born the Thursday before Father’s Day in 1992, the 3rd of September. That means this year her birthday occurs on Father’s Day.

That begs the question, what other years will this occur? Here’s some Python code that answers the question.

#!/usr/bin/python
#
# Find all the years when my daughter's
# birthday and Father's day coincide
# from the year of her birth till 2100

import time

for i in range(1992, 2100):
	dt = "3 09 " + str(i)
	tt = time.strptime(dt, "%d %m %Y")
    	if tt.tm_wday == 6:
    		print i

I love you, Jessica. My favourite Father’s Day gift ever, always.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s