python-checkio/Dropbox/unlucky-days.py

22 lines
590 B
Python

from datetime import date
def checkio(year: int) -> int:
count = 0
for month in range(1, 13):
current_date = date(year, month, 13)
if current_date.weekday() == 4:
count += 1
return count
if __name__ == '__main__':
print("Example:")
print(checkio(2015))
# 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"
assert checkio(2689) == 2, "Third"
print("Coding complete? Click 'Check' to earn cool rewards!")