Skip to content

Instantly share code, notes, and snippets.

@HorlogeSkynet
Created December 14, 2019 13:26
Show Gist options
  • Save HorlogeSkynet/a43a1ae3f7911b8a6564f6248c7b9ded to your computer and use it in GitHub Desktop.
Save HorlogeSkynet/a43a1ae3f7911b8a6564f6248c7b9ded to your computer and use it in GitHub Desktop.
Simple Family Challenge : Show the leap years of the 20th and 21st centuries starting on a Wednesday
#!/usr/bin/env python3
import calendar
import datetime
for year in range(1900, 2100):
if not calendar.isleap(year):
continue
first_day_of_year = datetime.date(
year=year,
month=1,
day=1
)
if first_day_of_year.weekday() == calendar.WEDNESDAY:
print(first_day_of_year.strftime("%A, %d %B %Y"))
"""
Wednesday, 01 January 1908
Wednesday, 01 January 1936
Wednesday, 01 January 1964
Wednesday, 01 January 1992
Wednesday, 01 January 2020
Wednesday, 01 January 2048
Wednesday, 01 January 2076
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment