# Friday13Standard.py Copyright (c) Kari Laitinen # http://www.naturalprogramming.com # 2006-05-04 File created. # 2022-12-18 Converted to Python 3. from datetime import date from datetime import timedelta # This program works almost like Friday13.py days_of_week = ( "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ) date_to_increment = date.today() number_of_friday13_dates_to_print = 10 print( "\n The following are the next such dates" \ "\n that are Fridays and the 13th days" \ "\n of a month: " ) while number_of_friday13_dates_to_print > 0 : while date_to_increment.weekday() != 4 or \ date_to_increment.day != 13 : date_to_increment += timedelta( 1 ) print( "\n %s, %s" % ( date_to_increment.isoformat(), days_of_week[ date_to_increment.weekday() ] ), end="" ) date_to_increment += timedelta( 27 ) number_of_friday13_dates_to_print -= 1 print( "\n" )