Files
euler/src/task19 - Counting Sundays.py
2020-06-21 23:53:32 +02:00

38 lines
574 B
Python

#Day number, month, year
date = [366, 1, 1901]
Month = {
1:31,
2:28,
3:31,
4:30,
5:31,
6:30,
7:31,
8:31,
9:30,
10:31,
11:30,
12:31
}
result = 0
while date[2]<=2000:
date[1]=1
Month[2]=28
if date[2]%4==0:
if date[2]%100==0 and date[2]%400!=0:
print("special: " + str(date[2]))
break
Month[2]=29
for i in range(1,13):
date [0]+=Month[i]
if date[0]%7==0:
result+=1
date[2]+=1
print(result)