Created
December 14, 2019 13:26
-
-
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
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
#!/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