_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.

Difficulty: EASY
Starter code: def unlucky_days(year):
	

Solutions:
from datetime import date

def unlucky_days(year):
	return sum((date(year, m, 13).weekday() == 4 for m in range(1, 13)))


from calendar import weekday

def unlucky_days(year):
	return sum((1 for i in range(1, 13) if weekday(year, i, 13) == 4))


from datetime import datetime

def unlucky_days(year):
	return sum((datetime(year, month, 13).weekday() == 4 for month in range(1, 13)))


from datetime import date

def unlucky_days(year):
	counter = 0
	for months in range(1, 13):
		if date(year, months, 13).weekday() == 4:
			counter += 1
	return counter


import datetime as d
import calendar

def unlucky_days(year):
	l = []
	for i in range(1, 13):
		l.append(calendar.monthrange(year, i)[1])
	count = 0
	for i in range(0, 12):
		if l[i] >= 28 and d.date(year, i + 1, 13).weekday() == 4:
			count += 1
	return count


import datetime

def unlucky_days(year):
	friday13 = 0
	months = range(1, 13)
	for month in months:
		if datetime.date(year, month, 13).weekday() == 4:
			friday13 += 1
	return friday13


unlucky_days = lambda y: sum((__import__('datetime').date(y, m, 13).weekday() == 4 for m in range(1, 13)))


def unlucky_days(y):
	count = 0
	for m in range(3, 15):
		if m == 13:
			y -= 1
		if (y % 100 + y % 100 // 4 + y // 100 // 4 - 2 * (y // 100) + 26 * (m + 1) // 10 + 12) % 7 == 5:
			count += 1
	return count


import calendar

def unlucky_days(year):
	return [calendar.weekday(year, m, 13) for m in range(1, 13)].count(4)


from datetime import date
unlucky_days = lambda year: sum((date(year, month, 13).weekday() == 4 for month in range(1, 13)))


def unlucky_days(year):
	x = 0
	import datetime
	for i in range(1, 13):
		if datetime.date(year, i, 13).weekday() == 4:
			x = x + 1
	return x


def unlucky_days(year):
	import calendar
	fridays = 0
	for i in range(1, 13):
		if calendar.weekday(year, i, 13) == 4:
			fridays += 1
	return fridays


def unlucky_days(year):
	import datetime
	(i, count) = (1, 0)
	while i <= 12:
		if datetime.datetime(year, i, 13).strftime('%w') == '5':
			count += 1
		i += 1
	return count


from datetime import date

def unlucky_days(year):
	black_fridays = 0
	for month in range(1, 13):
		if date(year, month, 13).isoweekday() == 5:
			black_fridays += 1
	return black_fridays


import calendar

def unlucky_days(year):
	answer = 0
	for month in range(1, 13):
		for day in calendar.Calendar().itermonthdays2(year, month):
			if day[0] == 13 and day[1] == 4:
				answer += 1
	return answer


import datetime

def unlucky_days(y):
	return len([i for i in range(12) if datetime.date(y, i + 1, 13).weekday() == 4])


from datetime import datetime

def unlucky_days(year):
	return sum((True for month in range(1, 13) if datetime(year=year, month=month, day=13).weekday() == 4))


def unlucky_days(year):
	c = year // 100
	y = year - 100 * c
	c1 = (year - 1) // 100
	y1 = year - 1 - 100 * c1
	return (1 if (y1 + y1 // 4 + c1 // 4 - 2 * c1 + 26 * (13 + 1) // 10 + 12) % 7 == 5 else 0) + (1 if (y1 + y1 // 4 + c1 // 4 - 2 * c1 + 26 * (14 + 1) // 10 + 12) % 7 == 5 else 0) + sum((1 for m in range(3, 13) if (y + y // 4 + c // 4 - 2 * c + 26 * (m + 1) // 10 + 12) % 7 == 5))


import calendar

def unlucky_days(year):
	f13 = 0
	for i in range(1, 13):
		c = calendar.monthcalendar(year, i)
		for f in [c[0], c[1], c[2], c[3]]:
			if f[calendar.FRIDAY] == 13:
				f13 += 1
	return f13


import time

def unlucky_days(y):
	return sum([time.strptime('%s-%d-13' % (y, x + 1), '%Y-%m-%d').tm_wday == 4 for x in range(12)])


import datetime

def unlucky_days(year):
	return sum(map(lambda x: datetime.datetime(year, x, 13).weekday() == 4, range(1, 13)))


import calendar
c = calendar.Calendar()

def unlucky_days(year):
	cont = 0
	for mes in range(1, 13):
		for i in c.monthdayscalendar(year, mes):
			if i[4] == 13:
				cont = cont + 1
	return cont


from datetime import datetime

def unlucky_days(year):
	return sum((1 for x in range(1, 13) if datetime(year, x, 13).strftime('%a') == 'Fri'))


import datetime

def unlucky_days(n):
	t = 0
	initial_date = datetime.date(n, 1, 1)
	for e in range(1, 365):
		my_date = initial_date + datetime.timedelta(days=e)
		if my_date.isoweekday() == 5 and my_date.day == 13:
			t += 1
	return t


from calendar import weekday

def unlucky_days(year):
	c = 0
	for m in range(1, 13):
		u = weekday(year, m, 13)
		if u == 4:
			c += 1
	return c


import datetime as dt

def unlucky_days(y):
	return sum((dt.datetime(y, i + 1, 13).weekday() == 4 for i in range(12)))


from datetime import date, timedelta

def unlucky_days(year):
	d = date(year, 1, 1)
	d += timedelta(days=4 - d.weekday())
	counter = 0
	while d.year != year + 1:
		if d.weekday() == 4 and d.day == 13:
			counter += 1
		d += timedelta(days=7)
	return counter


import datetime

def unlucky_days(year):
	sum = 0
	for month in range(1, 13):
		date = datetime.datetime(year, month, 13).strftime('%w')
		if date == '5':
			sum += 1
	return sum


from datetime import datetime

def unlucky_days(year):
	return sum(map(lambda i: datetime(year, i, 13).weekday() == 4, [i for i in range(1, 13)]))


import datetime

def unlucky_days(year):
	howmany = 0
	for i in range(1, 13):
		day = datetime.datetime(year, i, 13)
		if day.weekday() == 4:
			howmany += 1
	return howmany


from datetime import date, timedelta

def unlucky_days(year):
	count = 0
	start_day = date(year, 1, 1)
	end_day = date(year, 12, 31)
	while start_day <= end_day:
		if start_day.weekday() == 4 and start_day.day == 13:
			count += 1
		else:
			pass
		start_day += timedelta(days=1)
	return count


import datetime

def unlucky_days(year):
	return sum((1 for month in range(1, 13) if datetime.date(year, month, 13).isoweekday() == 5))


import datetime

def unlucky_days(year):
	cnt = 0
	for i in range(1, 13):
		d = datetime.datetime(year, i, 13)
		if d.weekday() == 4:
			cnt += 1
	return cnt


import datetime

def unlucky_days(year):
	sm = 0
	for i in range(1, 13):
		dt = datetime.datetime(year, i, 13)
		if dt.strftime('%A') == 'Friday':
			sm += 1
	return sm


from datetime import date, timedelta

def calc(y):
	st = date(y, 1, 1)
	fin = date(y, 12, 31)
	numday = timedelta(days=1)
	while st < fin:
		if st.weekday() == 4 and st.day == 13:
			yield st
		st = st + numday

def unlucky_days(year):
	count = 0
	res = [str(i) for y in range(year - 1, year + 1) for i in calc(y)]
	for x in range(len(res)):
		if str(year) in res[x]:
			count = count + 1
	return count


import datetime

def unlucky_days(year):
	i = 0
	for item in range(1, 13):
		day = datetime.date(year, item, 13).isoweekday()
		if day == 5:
			i += 1
	return i


unlucky_days = lambda y: len([m for m in range(1, 13) if __import__('datetime').date(y, m, 13).weekday() == 4])


import calendar
import datetime

def unlucky_days(year):
	start_date = datetime.date(year, 1, 1)
	end_date = datetime.date(year, 12, 31)
	delta = datetime.timedelta(days=1)
	counter = 0
	while start_date <= end_date:
		year = int(str(start_date)[:4])
		month = int(str(start_date)[5:7])
		day = int(str(start_date)[8:10])
		if day == 13 and calendar.weekday(year, month, day) == 4:
			counter += 1
		start_date += delta
	return counter


import datetime

def unlucky_days(n):
	c = 0
	d = datetime.timedelta(days=1)
	t = datetime.date(n, 1, 1)
	while t != datetime.date(n, 12, 31):
		if t.day == 13 and t.strftime('%A') == 'Friday':
			c = c + 1
		t = t + d
	return c


import datetime

def unlucky_days(y):
	return sum((datetime.date(y, i, 13).weekday() == 4 for i in range(1, 13)))


def unlucky_days(year):
	from datetime import datetime as dt
	count = 0
	for i in range(1, 13):
		if dt(year, i, 13).weekday() == 4:
			count += 1
	return count


import datetime

def unlucky_days(year):
	dates_13 = [datetime.datetime.strptime(f'{year}-{i}-13', '%Y-%m-%d').date() for i in range(1, 13)]
	res = [mon for mon in dates_13 if mon.isoweekday() == 5]
	return len(res)


import datetime

def unlucky_days(year):
	ans = 0
	for i in range(1, 13):
		day = datetime.date(year, i, 13)
		ans += day.weekday() == 4
	return ans


from datetime import date

def unlucky_days(year):
	return sum((date(year, month, 13).isoweekday() == 5 for month in range(1, 13)))

def __starting_point():
	assert unlucky_days(2015) == 3, 'First - 2015'
	assert unlucky_days(1986) == 1, 'Second - 1986'
__starting_point()


import datetime

def unlucky_days(year):
	count = 0
	for i in range(1, 13):
		a = datetime.datetime(year, i, 13)
		if a.strftime('%A') == 'Friday':
			count += 1
	return count


def unlucky_days(year):
	from datetime import datetime
	fridays = 0
	for i in range(1, 13):
		if datetime(year, i, 13).weekday() == 4:
			fridays += 1
	return fridays


import calendar

def unlucky_days(year):
	c = calendar.Calendar()
	counter = 0
	for month in range(1, 13):
		print(f'Months is {month}')
		for day in c.itermonthdays2(year, month):
			print(f'Day is {day}')
			if day[0] == 13 and day[1] == 4:
				print(f'This is Friday 13th {day}')
				counter += 1
	return counter


def unlucky_days(year):
	from datetime import datetime as dt
	from datetime import timedelta
	cnt = 0
	x = dt(year, 1, 1)
	while x.year == year:
		x = x + timedelta(days=1)
		if x.day == 13 and x.weekday() == 4:
			cnt = cnt + 1
	return cnt


from calendar import Calendar

def unlucky_days(year):
	x = Calendar()
	lst = []
	for month in range(1, 13):
		for days in x.itermonthdays2(year, month):
			if days[0] == 13 and days[1] == 4:
				lst.append(days)
	return len(lst)


import calendar

def unlucky_days(year):
	return sum([calendar.weekday(year, month, 13) == 4 for month in range(1, 13)])


from datetime import date

def unlucky_days(year, count=0):
	d1 = date.toordinal(date(year, 1, 1))
	d2 = date.toordinal(date(year, 12, 31))
	for i in range(d1, d2 + 1):
		if date.weekday(date.fromordinal(i)) == 4 and date.fromordinal(i).day == 13:
			count += 1
	return count


from datetime import date

def unlucky_days(year):
	NumDays = 0
	for i in range(1, 12 + 1):
		if date(year, i, 13).weekday() == 4:
			NumDays += 1
	return NumDays


from datetime import datetime
from functools import reduce

def unlucky_days(year):
	return reduce(lambda r, month: r + int(datetime.strptime(f'{year}-{month:02}-13', '%Y-%m-%d').weekday() == 4), range(1, 13), 0)


import pandas as pd
from datetime import datetime, timedelta

def unlucky_days(year):
	unlucky = 0
	start_date = datetime(year, 1, 1)
	end_date = datetime(year + 1, 1, 1)
	delta = end_date - start_date
	for i in range(delta.days + 1):
		day = start_date + timedelta(days=i)
		if day.strftime('%A') == 'Friday' and day.strftime('%d') == '13':
			unlucky += 1
	return unlucky


import calendar

def unlucky_days(year):
	return [calendar.weekday(year, x + 1, 13) for x in range(12)].count(4)


from datetime import date

def unlucky_days(year):
	thirteenths = []
	for m in range(1, 13):
		if date(year, m, 13).weekday() == 4:
			thirteenths.append(m)
		else:
			continue
	return len(thirteenths)


def unlucky_days(year):
	from datetime import date
	unluckyday = 0
	for month in range(1, 13):
		if date(year, month, 13).weekday() == 4:
			unluckyday += 1
	return unluckyday


import datetime

def unlucky_days(year):
	return sum((datetime.datetime(year, m + 1, 13).weekday() == 4 for m in range(12)))


import datetime

def unlucky_days(year):
	unlucky = 0
	for month in range(1, 13):
		if datetime.datetime(year, month, 13).weekday() == 4:
			unlucky += 1
	return unlucky


from functools import reduce
import datetime

def unlucky_days(year):
	return reduce(lambda a, b: a + (1 if datetime.datetime(year, b + 1, 13).weekday() == 4 else 0), range(12), 0)


import calendar
cal = calendar.Calendar()

def unlucky_days(input):
	count = 0
	for month in range(1, 13):
		results = cal.monthdays2calendar(input, month)
		for result in results:
			if (13, 4) in result:
				count += 1
	return count


import datetime

def unlucky_days(year):
	total = 0
	for x in range(1, 13):
		if datetime.date(year, x, 13).isoweekday() == 5:
			total += 1
	return total


from datetime import datetime as dt

def unlucky_days(year):
	return sum((int(dt(year, x, 13).weekday() == 4) for x in range(1, 13)))


from datetime import date

def unlucky_days(year):
	contador = 0
	for i in range(1, 13):
		dato = date(year, i, 13)
		if dato.weekday() == 4:
			contador += 1
	return contador


import datetime

def unlucky_days(year):
	total = 0
	month = 1
	while month < 13:
		test = datetime.datetime(year, month, 13)
		if datetime.datetime.weekday(test) == 4:
			total += 1
			month += 1
		else:
			month += 1
			continue
	return total


import datetime

def unlucky_days(year):
	date_ = datetime.date(year, 1, 1)
	while date_.weekday() != 4:
		date_ += datetime.timedelta(days=1)
	bad_days = 0
	while date_.year == year:
		if date_.day == 13:
			bad_days += 1
		date_ += datetime.timedelta(days=7)
	return bad_days


from datetime import datetime

def unlucky_days(year):
	spooky_days = 0
	if isinstance(year, int) and 0 < year < 10000:
		months = ('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12')
		for m in months:
			date_to_check = str(year) + '-' + m + '-13'
			day = datetime.strptime(date_to_check, '%Y-%m-%d').weekday()
			if day == 4:
				spooky_days += 1
	return spooky_days


from calendar import Calendar, MONDAY, FRIDAY

def unlucky_days(year):
	c = Calendar(firstweekday=MONDAY)
	return sum((1 for x in [[1 for (d, wd) in c.itermonthdays2(year, m) if wd == FRIDAY and d == 13] for m in range(1, 13)] if x))


from datetime import date

def unlucky_days(year):
	day = 13
	unlucky_days_count = 0
	for x in range(1, 13):
		date_obj = date(year=year, month=x, day=day)
		if date_obj.weekday() == 4:
			unlucky_days_count += 1
	return unlucky_days_count


from datetime import date, timedelta

def unlucky_days(year):
	start_date = date(year, 1, 1)
	end_date = date(year, 12, 31)
	delta_days = (end_date - start_date).days
	count = 0
	for n in range(delta_days):
		if start_date.strftime('%a %d') == 'Fri 13':
			count = count + 1
		start_date = start_date + timedelta(days=1)
	return count


import calendar

def unlucky_days(year):
	c = calendar.Calendar()
	return sum(sum(sum(list(c.yeardays2calendar(year, width=12)), []), []), []).count((13, 4))


import datetime

def unlucky_days(year):
	number = 0
	for month in range(1, 13):
		d = datetime.date(year, month, 13)
		if d.strftime('%A') == 'Friday':
			number += 1
	return number


import datetime

def unlucky_days(year):
	count = 0
	for month in range(12):
		if datetime.date(year, month + 1, 13).weekday() == 4:
			count += 1
	return count


from calendar import weekday as wd

def unlucky_days(year):
	day = 13
	k = 0
	for month in range(1, 13):
		if wd(year, month, day) == 4:
			k += 1
	return k


from datetime import timedelta, date

def unlucky_days(year):
	day_td = timedelta(days=1)
	date_i = date(year, 1, 1)
	unlucky_counter = 0
	for i in range(366):
		date_i = date_i + day_td
		if date_i.day == 13 and date_i.weekday() == 4:
			unlucky_counter += 1
	return unlucky_counter


from datetime import datetime

def unlucky_days(year):
	bfriday = 0
	for i in range(1, 13):
		if datetime(year, i, 13).strftime('%a') == 'Fri':
			bfriday += 1
	return bfriday


from datetime import datetime
FRIDAY = 4

def unlucky_days(year):
	bad_days_counter = 0
	for month in range(1, 13):
		if datetime(year, month, 13).weekday() == FRIDAY:
			bad_days_counter += 1
	return bad_days_counter


def unlucky_days(year):
	import datetime
	weekdays_13 = [datetime.date(year, mm, 13).weekday() for mm in range(1, 13)]
	return weekdays_13.count(4)


import calendar

def unlucky_days(year):
	c = 0
	cal = calendar.Calendar()
	for i in range(1, 13):
		for (d, w) in cal.itermonthdays2(year, i):
			if d == 13 and w == 4:
				c = c + 1
	return c


from datetime import datetime

def unlucky_days(year):
	days = 0
	date_string = '13/{}/{}'
	for i in range(1, 13):
		date_obj = datetime.strptime(date_string.format(str(i).zfill(2), str(year)), '%d/%m/%Y').weekday()
		if date_obj == 4:
			days += 1
	return days