Skip to content

Instantly share code, notes, and snippets.

@tebeka
Created June 6, 2011 18:17
Show Gist options
  • Save tebeka/1010752 to your computer and use it in GitHub Desktop.
Save tebeka/1010752 to your computer and use it in GitHub Desktop.
from datetime import date, timedelta
from calendar import SUNDAY
def main():
day = timedelta(days=1)
start = date(1901, 1, 1)
end = date(2000, 12, 31)
total = 0
while start < end:
if (start.day == 1) and (start.weekday() == SUNDAY):
total += 1
start += day
print(total)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment