Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Unlucky Days by hypehr96
import datetime
def checkio(year):
out = 0
for i in [1,2,3,4,5,6,7,8,9,10,11,12]:
dz = datetime.datetime(year, i, 13, 0, 0, 0, 0).weekday()
if dz==4:
out+=1
return out
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"
Jan. 6, 2017
Comments: