-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp19.py
57 lines (36 loc) · 906 Bytes
/
p19.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
year = 1900
month = 1
day = 1 #withinmonth
dayinweek = 0 #totaldays, badly named variably -- sorry
leap = False
month_30 = [9, 4, 6, 11]
suncount = 0
while year <= 2000:
dayinweek += 1
if dayinweek % 7==0 and year > 1900 and day==1:
suncount += 1
if year % 4 == 0: leap = True
else: leap = False
if leap == True and month == 2 and day >= 29:
month += 1
day = 1
continue
if leap == False and month == 2 and day >= 29:
month += 1
day = 1
continue
if month in month_30 and day >= 30:
day = 1
month += 1
continue
if month not in month_30 and day >= 31 and month != 12:
month += 1
day =1
continue
if month == 12 and day >= 31:
day = 1
month = 1
year += 1
continue
day += 1
print(suncount)