Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Unlucky Days by tomasz.pucka
import datetime
def checkio(year):
bfcounter=0
date=datetime.date(year, 1, 1)
oneday=datetime.timedelta(days=1)
while(date.year==year):
if(date.weekday()==4 and date.day==13): bfcounter+=1
date+=oneday
return bfcounter
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert checkio(2015) == 3, "First - 2015"
assert checkio(1986) == 1, "Second - 1986"
Nov. 5, 2016