#! /usr/bin/env python3 """ pe19.py https://mind.kittttttan.info/py/pe19 """ from datetime import date def pe19(n=2000): """ How many Sundays fell on the first of the month during the twentieth century? """ s = 0 for y in range(1901, n + 1): for m in range(1, 13): d = date(y, m, 1) if d.weekday() == 6: s += 1 print(s) if __name__ == "__main__": pe19()