This one was just annoying. I was putting it off for a while too. Again, the biggest issue was reading the directions.
def leap(y):
if y in [1900, 2000]: return 'FALSE'
elif y%4 == 0: return 'TRUE'
else: return 'FALSE'
def monthlength(m, y):
if m in [1, 3, 5, 7, 8, 10, 12]: return 31
elif m in [4, 6, 9, 11]: return 30
elif m == 2:
if leap(y) == 'TRUE': return 29
else: return 28
dayofweek = 1
sum = 0
for y in range(1900, 2001):
for m in range(1, 13):
for d in range(1, monthlength(m, y)+1):
print y, m, d, dayofweek
if y >= 1901 and dayofweek == 0 and d == 1:
sum = sum + 1
if dayofweek == 6: dayofweek = 0
else: dayofweek = dayofweek + 1
print sum