Was lazy, used datetime library for this

This commit is contained in:
2020-04-11 22:56:17 +02:00
parent 6422ce19ae
commit 8800c2030d

24
19/main.py Normal file
View File

@@ -0,0 +1,24 @@
import os
import datetime
# How many sundays fell on the first of the month in the twentieth century?
def getFirsts(minYear, maxYear):
res = 0
for year in range(minYear, maxYear + 1):
for month in range(1, 13):
if datetime.datetime(year, month, 1).weekday() == 6:
res = res + 1
return res
def main():
print("Hello, this is Patrick")
print(getFirsts(1901, 2000))
if __name__ == "__main__":
main()