Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.21 KB | None | 0 0
  1. import datetime
  2. from datetime import date
  3. from datetime import timedelta
  4.  
  5. def calc_easter(year):
  6. a = year % 19
  7. b = year//100
  8. c = year % 100
  9. d = (19 * a + b - b // 4 - ((b - (b + 8) // 25 + 1) // 3) + 15) % 30
  10. e = (32 + 2 * (b % 4) + 2 * (c // 4) - d - (c % 4)) % 7
  11. f = d + e - 7 * ((a + 11 * d + 22 * e) // 451) + 114
  12. month = f // 31
  13. day = f % 31 + 1
  14. return date(year, month, day)
  15.  
  16. completed = 0
  17. startyear = 2019
  18. recurse = 0
  19.  
  20. while completed == 0 and startyear < 3000:
  21.  
  22. startyear = startyear
  23. figureitout = 0
  24. holidays = 0
  25.  
  26. easterdate = calc_easter(startyear)
  27. newyears = datetime.datetime(startyear, 1,1)
  28. easterdate = calc_easter(startyear)
  29. easterd = easterdate + timedelta(days=1)
  30. labourday = datetime.datetime(startyear, 5, 1)
  31. vday = labourday + timedelta(days=7)
  32. aday = easterdate + timedelta(days = 39)
  33. wmon = aday + timedelta(days = 11)
  34. bday = datetime.datetime(startyear, 7, 14)
  35. amday = datetime.datetime(startyear, 8, 15)
  36. asday = datetime.datetime(startyear, 11, 1)
  37. armday = datetime.datetime(startyear, 11, 11)
  38. cday = datetime.datetime(startyear, 12, 25)
  39.  
  40. bigdict = [newyears, easterd, labourday, vday, aday, wmon, bday, amday, asday, armday, cday]
  41.  
  42. for holiday in bigdict:
  43.  
  44. if holiday.weekday() <= 4:
  45. figureitout = figureitout +1
  46. holidays = holidays + 1
  47. if figureitout >= 12 and holidays < 11:
  48. startyear = startyear + 1
  49. completed = 0
  50. if figureitout > 12 and holidays == 11:
  51. startyear = startyear + 1
  52. completed = 0
  53. else:
  54. figureitout = figureitout +2
  55. holidays = holidays + 1
  56. if figureitout >= 12 and holidays < 11:
  57. startyear = startyear + 1
  58. completed = 0
  59. if figureitout > 12 and holidays == 11:
  60. startyear = startyear + 1
  61. completed = 0
  62.  
  63. if figureitout == 12 and holidays == 11 or figureitout == 11 and holidays == 11:
  64. if figureitout == 12:
  65. holidays = 10
  66. if figureitout == 11:
  67. holidays = 11
  68. print("Holidays = " + str(holidays) + " in the year " + str(startyear))
  69. startyear = startyear + 1
  70. recurse = 1
  71.  
  72. startyear = startyear
  73. figureitout = 0
  74. holidays = 0
  75.  
  76. easterdate = calc_easter(startyear)
  77. newyears = datetime.datetime(startyear, 1,1)
  78. easterdate = calc_easter(startyear)
  79. easterd = easterdate + timedelta(days=1)
  80. labourday = datetime.datetime(startyear, 5, 1)
  81. vday = labourday + timedelta(days=7)
  82. aday = easterdate + timedelta(days = 39)
  83. wmon = aday + timedelta(days = 11)
  84. bday = datetime.datetime(startyear, 7, 14)
  85. amday = datetime.datetime(startyear, 8, 15)
  86. asday = datetime.datetime(startyear, 11, 1)
  87. armday = datetime.datetime(startyear, 11, 11)
  88. cday = datetime.datetime(startyear, 12, 25)
  89.  
  90. bigdict = [newyears, easterd, labourday, vday, aday, wmon, bday, amday, asday, armday, cday]
  91.  
  92. for holiday in bigdict:
  93.  
  94. if holiday.weekday() <= 4:
  95. figureitout = figureitout +1
  96. holidays = holidays + 1
  97. if figureitout >= 12 and holidays < 11:
  98. startyear = startyear + 1
  99. completed = 0
  100. if figureitout > 12 and holidays == 11:
  101. startyear = startyear + 1
  102. completed = 0
  103. else:
  104. figureitout = figureitout +2
  105. holidays = holidays + 1
  106. if figureitout >= 12 and holidays < 11:
  107. startyear = startyear + 1
  108. completed = 0
  109. if figureitout > 12 and holidays == 11:
  110. startyear = startyear + 1
  111. completed = 0
  112.  
  113. if figureitout == 12 and holidays == 11 or figureitout == 11 and holidays == 11:
  114. if figureitout == 12:
  115. holidays = 10
  116. if figureitout == 11:
  117. holidays = 11
  118. print("Holidays = " + str(holidays) + " in the year " + str(startyear))
  119. startyear = startyear + 1
  120. recurse = 1
  121.  
  122. Holidays = 10 in the year 2019
  123. Holidays = 10 in the year 2025
  124. Holidays = 10 in the year 2030
  125. Holidays = 10 in the year 2031
  126. Holidays = 10 in the year 2042
  127. Holidays = 10 in the year 2047
  128. Holidays = 10 in the year 2053
  129. Holidays = 10 in the year 2058
  130. Holidays = 10 in the year 2059
  131. Holidays = 10 in the year 2070
  132. Holidays = 10 in the year 2075
  133. Holidays = 10 in the year 2081
  134. Holidays = 10 in the year 2086
  135. Holidays = 10 in the year 2087
  136. Holidays = 10 in the year 2098
  137. Holidays = 10 in the year 2104
  138. Holidays = 10 in the year 2110
  139. Holidays = 10 in the year 2115
  140. Holidays = 10 in the year 2121
  141. Holidays = 10 in the year 2126
  142. Holidays = 10 in the year 2127
  143. Holidays = 10 in the year 2138
  144. Holidays = 10 in the year 2143
  145. Holidays = 10 in the year 2149
  146. Holidays = 10 in the year 2154
  147. Holidays = 10 in the year 2155
  148. Holidays = 10 in the year 2166
  149. Holidays = 10 in the year 2171
  150. Holidays = 10 in the year 2177
  151. Holidays = 10 in the year 2182
  152. Holidays = 10 in the year 2183
  153. Holidays = 10 in the year 2194
  154. Holidays = 10 in the year 2199
  155. Holidays = 10 in the year 2200
  156. Holidays = 10 in the year 2206
  157. Holidays = 10 in the year 2211
  158. Holidays = 10 in the year 2217
  159. Holidays = 10 in the year 2222
  160. Holidays = 10 in the year 2223
  161. Holidays = 10 in the year 2234
  162. Holidays = 10 in the year 2239
  163. Holidays = 10 in the year 2245
  164. Holidays = 10 in the year 2250
  165. Holidays = 10 in the year 2251
  166. Holidays = 10 in the year 2262
  167. Holidays = 10 in the year 2267
  168. Holidays = 10 in the year 2273
  169. Holidays = 10 in the year 2278
  170. Holidays = 10 in the year 2279
  171. Holidays = 10 in the year 2290
  172. Holidays = 10 in the year 2295
  173. Holidays = 10 in the year 2301
  174. Holidays = 10 in the year 2302
  175. Holidays = 10 in the year 2307
  176. Holidays = 10 in the year 2313
  177. Holidays = 10 in the year 2318
  178. Holidays = 10 in the year 2319
  179. Holidays = 10 in the year 2330
  180. Holidays = 10 in the year 2335
  181. Holidays = 10 in the year 2341
  182. Holidays = 10 in the year 2346
  183. Holidays = 10 in the year 2347
  184. Holidays = 10 in the year 2358
  185. Holidays = 10 in the year 2363
  186. Holidays = 10 in the year 2369
  187. Holidays = 10 in the year 2374
  188. Holidays = 10 in the year 2375
  189. Holidays = 10 in the year 2386
  190. Holidays = 10 in the year 2391
  191. Holidays = 10 in the year 2397
  192. Holidays = 10 in the year 2402
  193. Holidays = 10 in the year 2403
  194. Holidays = 10 in the year 2414
  195. Holidays = 10 in the year 2419
  196. Holidays = 10 in the year 2425
  197. Holidays = 10 in the year 2430
  198. Holidays = 10 in the year 2431
  199. Holidays = 10 in the year 2442
  200. Holidays = 10 in the year 2447
  201. Holidays = 10 in the year 2453
  202. Holidays = 10 in the year 2458
  203. Holidays = 10 in the year 2459
  204. Holidays = 10 in the year 2470
  205. Holidays = 10 in the year 2475
  206. Holidays = 10 in the year 2481
  207. Holidays = 10 in the year 2486
  208. Holidays = 10 in the year 2487
  209. Holidays = 10 in the year 2498
  210. Holidays = 10 in the year 2504
  211. Holidays = 10 in the year 2510
  212. Holidays = 10 in the year 2515
  213. Holidays = 10 in the year 2521
  214. Holidays = 10 in the year 2526
  215. Holidays = 10 in the year 2527
  216. Holidays = 10 in the year 2538
  217. Holidays = 10 in the year 2543
  218. Holidays = 10 in the year 2549
  219. Holidays = 10 in the year 2554
  220. Holidays = 10 in the year 2555
  221. Holidays = 10 in the year 2566
  222. Holidays = 10 in the year 2571
  223. Holidays = 10 in the year 2577
  224. Holidays = 10 in the year 2582
  225. Holidays = 10 in the year 2583
  226. Holidays = 10 in the year 2594
  227. Holidays = 10 in the year 2599
  228. Holidays = 10 in the year 2600
  229. Holidays = 10 in the year 2606
  230. Holidays = 10 in the year 2611
  231. Holidays = 10 in the year 2617
  232. Holidays = 10 in the year 2622
  233. Holidays = 10 in the year 2623
  234. Holidays = 10 in the year 2634
  235. Holidays = 10 in the year 2639
  236. Holidays = 10 in the year 2645
  237. Holidays = 10 in the year 2650
  238. Holidays = 10 in the year 2651
  239. Holidays = 10 in the year 2662
  240. Holidays = 10 in the year 2667
  241. Holidays = 10 in the year 2673
  242. Holidays = 10 in the year 2678
  243. Holidays = 10 in the year 2679
  244. Holidays = 10 in the year 2690
  245. Holidays = 10 in the year 2695
  246. Holidays = 10 in the year 2701
  247. Holidays = 10 in the year 2702
  248. Holidays = 10 in the year 2707
  249. Holidays = 10 in the year 2713
  250. Holidays = 10 in the year 2718
  251. Holidays = 10 in the year 2719
  252. Holidays = 10 in the year 2730
  253. Holidays = 10 in the year 2735
  254. Holidays = 10 in the year 2741
  255. Holidays = 10 in the year 2746
  256. Holidays = 10 in the year 2747
  257. Holidays = 10 in the year 2758
  258. Holidays = 10 in the year 2763
  259. Holidays = 10 in the year 2769
  260. Holidays = 10 in the year 2774
  261. Holidays = 10 in the year 2775
  262. Holidays = 10 in the year 2786
  263. Holidays = 10 in the year 2791
  264. Holidays = 10 in the year 2797
  265. Holidays = 10 in the year 2802
  266. Holidays = 10 in the year 2803
  267. Holidays = 10 in the year 2814
  268. Holidays = 10 in the year 2819
  269. Holidays = 10 in the year 2825
  270. Holidays = 10 in the year 2830
  271. Holidays = 10 in the year 2831
  272. Holidays = 10 in the year 2842
  273. Holidays = 10 in the year 2847
  274. Holidays = 10 in the year 2853
  275. Holidays = 10 in the year 2858
  276. Holidays = 10 in the year 2859
  277. Holidays = 10 in the year 2870
  278. Holidays = 10 in the year 2875
  279. Holidays = 10 in the year 2881
  280. Holidays = 10 in the year 2886
  281. Holidays = 10 in the year 2887
  282. Holidays = 10 in the year 2898
  283. Holidays = 10 in the year 2904
  284. Holidays = 10 in the year 2910
  285. Holidays = 10 in the year 2915
  286. Holidays = 10 in the year 2921
  287. Holidays = 10 in the year 2926
  288. Holidays = 10 in the year 2927
  289. Holidays = 10 in the year 2938
  290. Holidays = 10 in the year 2943
  291. Holidays = 10 in the year 2949
  292. Holidays = 10 in the year 2954
  293. Holidays = 10 in the year 2955
  294. Holidays = 10 in the year 2966
  295. Holidays = 10 in the year 2971
  296. Holidays = 10 in the year 2977
  297. Holidays = 10 in the year 2982
  298. Holidays = 10 in the year 2983
  299. Holidays = 10 in the year 2994
  300. Holidays = 10 in the year 2999
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement