Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Unlucky Days by Rafal__Kotas
import calendar,datetime
def checkio(year):
s = datetime.date(year, 1, 1)
e = datetime.date(year, 12, 31)
delta = datetime.timedelta(days=1)
ile=0
while s <= e:
d=s.day
m=s.month
y=s.year
if(calendar.weekday(y,m,d)==4 and d==13):
ile=ile+1
s=s+delta
return (ile)
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. 1, 2016