Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- days = [31,28,31,30,31,30,31,31,30,31,30,31]
- leap = lambda rok: (rok % 4 == 0 and rok % 100 != 0) or rok % 400 == 0
- def mdays(year, month):
- if month == 1 and leap(year):
- return 29
- else:
- return days[month]
- year, month, day = 2000, 0, 6 #7 stycznia 2000, pierwszy piatek roku
- stop = 1000000000
- p = 0
- l = 0
- while year < stop:
- l += [365, 366][leap(year)]
- while month < 12:
- while day < mdays(year, month):
- if day == 12:
- #print("year: %d month: %d day: %d" % (year, month, day))
- p += 1
- day += 7
- day = (day + 7) % mdays(year, month)
- month += 1
- month = 0
- year += 1
- print (p/l)
Advertisement
Add Comment
Please, Sign In to add comment