You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Friday 13th or Black Friday is considered as unlucky day. Calculate how many unlucky days are in the given year. Find the number of Friday 13th in the given year. Input: Year as an integer. Output: Number of Black Fridays in the year as an integer. Examples: unluckyDays(2015) == 3 unluckyDays(1986) == 1 Note: In Ruby years will start from 1593.
"""
import datetime
def unlucky_days(year):
return sum(1 for month in range(1, 13) if datetime.date(year, month, 13).weekday() == 4)