Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
unluck solution in Clear category for Unlucky Days by Haradd
import datetime,calendar
def checkio(year):
count=0
for m in range(1, 13):
date = datetime.datetime(year, m, 13)
if datetime.date.weekday(date) == calendar.FRIDAY:
count+=1
return count
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. 10, 2016