# Weddingdates.py Copyright (c) Kari Laitinen # http://www.naturalprogramming.com # 2006-05-04 File created. # 2009-01-22 class ISODate used in place of Date # 2022-12-27 Converted to Python 3. # During compilation and execution, the file ISODate.py must be in # the same folder together with this program. from ISODate import ISODate date_to_increment = ISODate() # the current date number_of_dates_printed = 0 print( "\n These are easy-to-remember dates for weddings and" \ "\n other important events because the days and months" \ "\n consist of the digits used in the year: " ) while number_of_dates_printed < 60 : day_as_string = "%02d" % date_to_increment.day() month_as_string = "%02d" % date_to_increment.month() year_as_string = "%04d" % date_to_increment.year() if year_as_string.find( day_as_string[ 0 ] ) != -1 and \ year_as_string.find( day_as_string[ 1 ] ) != -1 and \ year_as_string.find( month_as_string[ 0 ] ) != -1 and \ year_as_string.find( month_as_string[ 1 ] ) != -1 : # Now we have found a date that meets our requirements. if number_of_dates_printed % 5 == 0 : print( "" ) # an empty line print( " %s" % date_to_increment, end="" ) number_of_dates_printed += 1 date_to_increment.increment() print( "\n" )