programming-examples/python/Date/Program to count the number of Monday of the 1st day of the month between two years.py
2019-11-15 12:59:38 +01:00

9 lines
252 B
Python

import datetime
from datetime import datetime
monday1 = 0
months = range(1,13)
for year in range(2015, 2017):
for month in months:
if datetime(year, month, 1).weekday() == 0:
monday1 += 1
print(monday1)