Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- from datetime import date
- from datetime import timedelta
- def calc_easter(year):
- a = year % 19
- b = year//100
- c = year % 100
- d = (19 * a + b - b // 4 - ((b - (b + 8) // 25 + 1) // 3) + 15) % 30
- e = (32 + 2 * (b % 4) + 2 * (c // 4) - d - (c % 4)) % 7
- f = d + e - 7 * ((a + 11 * d + 22 * e) // 451) + 114
- month = f // 31
- day = f % 31 + 1
- return date(year, month, day)
- completed = 0
- startyear = 2019
- recurse = 0
- while completed == 0 and startyear < 3000:
- startyear = startyear
- figureitout = 0
- holidays = 0
- easterdate = calc_easter(startyear)
- newyears = datetime.datetime(startyear, 1,1)
- easterdate = calc_easter(startyear)
- easterd = easterdate + timedelta(days=1)
- labourday = datetime.datetime(startyear, 5, 1)
- vday = labourday + timedelta(days=7)
- aday = easterdate + timedelta(days = 39)
- wmon = aday + timedelta(days = 11)
- bday = datetime.datetime(startyear, 7, 14)
- amday = datetime.datetime(startyear, 8, 15)
- asday = datetime.datetime(startyear, 11, 1)
- armday = datetime.datetime(startyear, 11, 11)
- cday = datetime.datetime(startyear, 12, 25)
- bigdict = [newyears, easterd, labourday, vday, aday, wmon, bday, amday, asday, armday, cday]
- for holiday in bigdict:
- if holiday.weekday() <= 4:
- figureitout = figureitout +1
- holidays = holidays + 1
- if figureitout >= 12 and holidays < 11:
- startyear = startyear + 1
- completed = 0
- if figureitout > 12 and holidays == 11:
- startyear = startyear + 1
- completed = 0
- else:
- figureitout = figureitout +2
- holidays = holidays + 1
- if figureitout >= 12 and holidays < 11:
- startyear = startyear + 1
- completed = 0
- if figureitout > 12 and holidays == 11:
- startyear = startyear + 1
- completed = 0
- if figureitout == 12 and holidays == 11 or figureitout == 11 and holidays == 11:
- if figureitout == 12:
- holidays = 10
- if figureitout == 11:
- holidays = 11
- print("Holidays = " + str(holidays) + " in the year " + str(startyear))
- startyear = startyear + 1
- recurse = 1
- startyear = startyear
- figureitout = 0
- holidays = 0
- easterdate = calc_easter(startyear)
- newyears = datetime.datetime(startyear, 1,1)
- easterdate = calc_easter(startyear)
- easterd = easterdate + timedelta(days=1)
- labourday = datetime.datetime(startyear, 5, 1)
- vday = labourday + timedelta(days=7)
- aday = easterdate + timedelta(days = 39)
- wmon = aday + timedelta(days = 11)
- bday = datetime.datetime(startyear, 7, 14)
- amday = datetime.datetime(startyear, 8, 15)
- asday = datetime.datetime(startyear, 11, 1)
- armday = datetime.datetime(startyear, 11, 11)
- cday = datetime.datetime(startyear, 12, 25)
- bigdict = [newyears, easterd, labourday, vday, aday, wmon, bday, amday, asday, armday, cday]
- for holiday in bigdict:
- if holiday.weekday() <= 4:
- figureitout = figureitout +1
- holidays = holidays + 1
- if figureitout >= 12 and holidays < 11:
- startyear = startyear + 1
- completed = 0
- if figureitout > 12 and holidays == 11:
- startyear = startyear + 1
- completed = 0
- else:
- figureitout = figureitout +2
- holidays = holidays + 1
- if figureitout >= 12 and holidays < 11:
- startyear = startyear + 1
- completed = 0
- if figureitout > 12 and holidays == 11:
- startyear = startyear + 1
- completed = 0
- if figureitout == 12 and holidays == 11 or figureitout == 11 and holidays == 11:
- if figureitout == 12:
- holidays = 10
- if figureitout == 11:
- holidays = 11
- print("Holidays = " + str(holidays) + " in the year " + str(startyear))
- startyear = startyear + 1
- recurse = 1
- Holidays = 10 in the year 2019
- Holidays = 10 in the year 2025
- Holidays = 10 in the year 2030
- Holidays = 10 in the year 2031
- Holidays = 10 in the year 2042
- Holidays = 10 in the year 2047
- Holidays = 10 in the year 2053
- Holidays = 10 in the year 2058
- Holidays = 10 in the year 2059
- Holidays = 10 in the year 2070
- Holidays = 10 in the year 2075
- Holidays = 10 in the year 2081
- Holidays = 10 in the year 2086
- Holidays = 10 in the year 2087
- Holidays = 10 in the year 2098
- Holidays = 10 in the year 2104
- Holidays = 10 in the year 2110
- Holidays = 10 in the year 2115
- Holidays = 10 in the year 2121
- Holidays = 10 in the year 2126
- Holidays = 10 in the year 2127
- Holidays = 10 in the year 2138
- Holidays = 10 in the year 2143
- Holidays = 10 in the year 2149
- Holidays = 10 in the year 2154
- Holidays = 10 in the year 2155
- Holidays = 10 in the year 2166
- Holidays = 10 in the year 2171
- Holidays = 10 in the year 2177
- Holidays = 10 in the year 2182
- Holidays = 10 in the year 2183
- Holidays = 10 in the year 2194
- Holidays = 10 in the year 2199
- Holidays = 10 in the year 2200
- Holidays = 10 in the year 2206
- Holidays = 10 in the year 2211
- Holidays = 10 in the year 2217
- Holidays = 10 in the year 2222
- Holidays = 10 in the year 2223
- Holidays = 10 in the year 2234
- Holidays = 10 in the year 2239
- Holidays = 10 in the year 2245
- Holidays = 10 in the year 2250
- Holidays = 10 in the year 2251
- Holidays = 10 in the year 2262
- Holidays = 10 in the year 2267
- Holidays = 10 in the year 2273
- Holidays = 10 in the year 2278
- Holidays = 10 in the year 2279
- Holidays = 10 in the year 2290
- Holidays = 10 in the year 2295
- Holidays = 10 in the year 2301
- Holidays = 10 in the year 2302
- Holidays = 10 in the year 2307
- Holidays = 10 in the year 2313
- Holidays = 10 in the year 2318
- Holidays = 10 in the year 2319
- Holidays = 10 in the year 2330
- Holidays = 10 in the year 2335
- Holidays = 10 in the year 2341
- Holidays = 10 in the year 2346
- Holidays = 10 in the year 2347
- Holidays = 10 in the year 2358
- Holidays = 10 in the year 2363
- Holidays = 10 in the year 2369
- Holidays = 10 in the year 2374
- Holidays = 10 in the year 2375
- Holidays = 10 in the year 2386
- Holidays = 10 in the year 2391
- Holidays = 10 in the year 2397
- Holidays = 10 in the year 2402
- Holidays = 10 in the year 2403
- Holidays = 10 in the year 2414
- Holidays = 10 in the year 2419
- Holidays = 10 in the year 2425
- Holidays = 10 in the year 2430
- Holidays = 10 in the year 2431
- Holidays = 10 in the year 2442
- Holidays = 10 in the year 2447
- Holidays = 10 in the year 2453
- Holidays = 10 in the year 2458
- Holidays = 10 in the year 2459
- Holidays = 10 in the year 2470
- Holidays = 10 in the year 2475
- Holidays = 10 in the year 2481
- Holidays = 10 in the year 2486
- Holidays = 10 in the year 2487
- Holidays = 10 in the year 2498
- Holidays = 10 in the year 2504
- Holidays = 10 in the year 2510
- Holidays = 10 in the year 2515
- Holidays = 10 in the year 2521
- Holidays = 10 in the year 2526
- Holidays = 10 in the year 2527
- Holidays = 10 in the year 2538
- Holidays = 10 in the year 2543
- Holidays = 10 in the year 2549
- Holidays = 10 in the year 2554
- Holidays = 10 in the year 2555
- Holidays = 10 in the year 2566
- Holidays = 10 in the year 2571
- Holidays = 10 in the year 2577
- Holidays = 10 in the year 2582
- Holidays = 10 in the year 2583
- Holidays = 10 in the year 2594
- Holidays = 10 in the year 2599
- Holidays = 10 in the year 2600
- Holidays = 10 in the year 2606
- Holidays = 10 in the year 2611
- Holidays = 10 in the year 2617
- Holidays = 10 in the year 2622
- Holidays = 10 in the year 2623
- Holidays = 10 in the year 2634
- Holidays = 10 in the year 2639
- Holidays = 10 in the year 2645
- Holidays = 10 in the year 2650
- Holidays = 10 in the year 2651
- Holidays = 10 in the year 2662
- Holidays = 10 in the year 2667
- Holidays = 10 in the year 2673
- Holidays = 10 in the year 2678
- Holidays = 10 in the year 2679
- Holidays = 10 in the year 2690
- Holidays = 10 in the year 2695
- Holidays = 10 in the year 2701
- Holidays = 10 in the year 2702
- Holidays = 10 in the year 2707
- Holidays = 10 in the year 2713
- Holidays = 10 in the year 2718
- Holidays = 10 in the year 2719
- Holidays = 10 in the year 2730
- Holidays = 10 in the year 2735
- Holidays = 10 in the year 2741
- Holidays = 10 in the year 2746
- Holidays = 10 in the year 2747
- Holidays = 10 in the year 2758
- Holidays = 10 in the year 2763
- Holidays = 10 in the year 2769
- Holidays = 10 in the year 2774
- Holidays = 10 in the year 2775
- Holidays = 10 in the year 2786
- Holidays = 10 in the year 2791
- Holidays = 10 in the year 2797
- Holidays = 10 in the year 2802
- Holidays = 10 in the year 2803
- Holidays = 10 in the year 2814
- Holidays = 10 in the year 2819
- Holidays = 10 in the year 2825
- Holidays = 10 in the year 2830
- Holidays = 10 in the year 2831
- Holidays = 10 in the year 2842
- Holidays = 10 in the year 2847
- Holidays = 10 in the year 2853
- Holidays = 10 in the year 2858
- Holidays = 10 in the year 2859
- Holidays = 10 in the year 2870
- Holidays = 10 in the year 2875
- Holidays = 10 in the year 2881
- Holidays = 10 in the year 2886
- Holidays = 10 in the year 2887
- Holidays = 10 in the year 2898
- Holidays = 10 in the year 2904
- Holidays = 10 in the year 2910
- Holidays = 10 in the year 2915
- Holidays = 10 in the year 2921
- Holidays = 10 in the year 2926
- Holidays = 10 in the year 2927
- Holidays = 10 in the year 2938
- Holidays = 10 in the year 2943
- Holidays = 10 in the year 2949
- Holidays = 10 in the year 2954
- Holidays = 10 in the year 2955
- Holidays = 10 in the year 2966
- Holidays = 10 in the year 2971
- Holidays = 10 in the year 2977
- Holidays = 10 in the year 2982
- Holidays = 10 in the year 2983
- Holidays = 10 in the year 2994
- Holidays = 10 in the year 2999
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement