2023年2月24日 星期五

21世紀13日星期五

 import datetime


year = 2000

month = 1

day = 1


c = 0

date = datetime.date(year, month, day)

for i in range(200000):

    weekday = date.weekday()

    day = date.day

    month = date.month

    year = date.year

    

    if year>2099:

        break

    

    weekday_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']

    if day==13 and weekday_names[weekday] == 'Friday':

        print(f"{c}: {year}/{month}/{day} is a {weekday_names[weekday]}")

        c = c + 1     

    date = date + datetime.timedelta(days=1)

沒有留言: