24 lines
442 B
Python
24 lines
442 B
Python
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() |