# Friday13.py Copyright (c) Kari Laitinen # http://www.naturalprogramming.com # 2006-05-01 File created. # 2009-01-22 class ISODate used in place of Date # 2022-12-18 Converted to Python 3. # In the pythonfilesextra folder you can find a program # named Friday13Faster.py which is a faster version of # this program. from ISODate import ISODate print( "\n This program can print you a list of 10 dates" \ "\n that are Fridays and 13th days of a month." \ "\n Please, type in a date from which you want" \ "\n the calculation to begin. Type in the date" \ "\n in form YYYY-MM-DD and use two digits for days" \ "\n and months and four digitsfor the year: ", end="" ) given_date_as_string = input() date_to_increment = ISODate( given_date_as_string ) number_of_friday13_dates_to_print = 10 print( "\n It is a common belief that you may have" \ "\n bad luck on the following dates:" ) while number_of_friday13_dates_to_print > 0 : while date_to_increment.index_for_day_of_week() != 4 or \ date_to_increment.day() != 13 : date_to_increment.increment() print( "\n %s, %s" % ( date_to_increment, date_to_increment.get_day_of_week() ), end="" ) date_to_increment.increment() number_of_friday13_dates_to_print -= 1 print( "\n" )