Created
December 2, 2021 04:48
-
-
Save paulgear/464a1105e1de52e476d26b38185a3260 to your computer and use it in GitHub Desktop.
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 datetime | |
def all_dates(beginyear = 2000, endyear = 2100): | |
for year in range(beginyear, endyear): | |
for month in range(1, 13): | |
for day in range(1, 32): | |
try: | |
yield datetime.date(year, month, day) | |
except ValueError: | |
pass | |
print('Palindates:') | |
for d in all_dates(): | |
datestr = d.isoformat().replace('-', '') | |
if datestr == ''.join(reversed(datestr)): | |
print(d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment