Return to Snippet

Revision: 27502
at June 11, 2010 19:31 by chroto


Initial Code
!/usr/bin/python

# Project Euler - Problem 19

months = [["JAN",2], ["FEB", 5],["MAR", 5],["APR",1],["MAY",3],["JUNE",6],
          ["JULY",1],["AUG",4],["SEPT",7],["OCT",2],["NOV",5],["DEC",7]]
cnt = 0

for year in range(1901, 2001):
    for month in months:
        if month[1] % 7 == 0:
            cnt += 1
        if month[0] != "FEB" and year+1 % 4 == 0: # Leap year
            month[1] += 2
        elif month[0] == "FEB" and year % 4 == 0:
            month[1] += 2
        else:
            month[1] += 1

print cnt

Initial URL

                                

Initial Description

                                

Initial Title
Project Euler - Problem 19

Initial Tags

                                

Initial Language
Python