All of the animals are having a feast! Each animal is bringing one dish. There is just one rule: the dish must start and end with the same letters as the animal's name. For example, the great blue heron is bringing garlic naan and the chickadee is bringing chocolate cake.

Write a function `feast` that takes the animal's name and dish as arguments and returns true or false to indicate whether the beast is allowed to bring the dish to the feast.

Assume that `beast` and `dish` are always lowercase strings, and that each has at least two letters. `beast` and `dish` may contain hyphens and spaces, but these will not appear at the beginning or end of the string. They will not contain numerals.

Difficulty: EASY
Starter code: def feast(beast, dish):
	

Solutions:
def feast(beast, dish):
	return beast[0] == dish[0] and dish[-1] == beast[-1]


def feast(beast, dish):
	return beast.startswith(dish[0]) and beast.endswith(dish[-1])


def feast(beast, dish):
	return True if beast[:1] == dish[:1] and beast[-1] == dish[-1] else False


def feast(b, d):
	return b[::len(b) - 1] == d[::len(d) - 1]


feast = lambda beast, dish: beast[0].lower() == dish[0].lower() and beast[-1].lower() == dish[-1].lower()


feast = lambda beast, dish: all([beast[i] == dish[i] for i in [0, -1]])


feast = lambda b, d: (b[0], b[-1]) == (d[0], d[-1])


def feast(beast, dish):
	pass
	b = beast.replace(' ', '')
	length_b = len(b)
	d = dish.replace(' ', '')
	length_d = len(d)
	new_b = b[0] + b[-1]
	new_d = d[0] + d[-1]
	return new_b == new_d


def feast(beast: str, dish: str) -> bool:
	return beast[0] == dish[0] and beast[-1] == dish[-1]


def feast(beast, dish):
	dish_valid = (beast[0], beast[-1]) == (dish[0], dish[-1])
	return dish_valid


def feast(beast, dish):
	return True if (beast[0], beast[-1]) == (dish[0], dish[-1]) else False
	pass


def feast(beast, dish):
	if beast[0] == dish[0] and beast[-1] == dish[-1]:
		return True
	return False


def feast(b, d):
	return b[0] + b[-1] == d[0] + d[-1]


def feast(beast, dish):
	return beast[::len(beast) - 1] == dish[::len(dish) - 1]


import re

def feast(beast, dish):
	return re.sub('\\B(.*)\\B', '', beast) == re.sub('\\B(.*)\\B', '', dish)


feast = lambda a, b: 2 == (lambda a, b, z, j: (lambda f, arg: sum([f(*a) for a in arg]))(lambda a, b: a == b, [[a[j], b[j]], [a[z], b[z]]]))(a, b, (lambda : 777).__code__.co_nlocals, -(lambda _: 777).__code__.co_nlocals)


def feast(beast, dish):
	print(beast[1])
	print(beast[-1])
	print(dish[1])
	print(dish[-1])
	if beast[0] == dish[0] and beast[-1] == dish[-1]:
		return True
	else:
		return False


def feast(beast, dish):
	x = beast[0] + beast[len(beast) - 1]
	y = dish[0] + dish[len(dish) - 1]
	if x == y:
		return True
	else:
		return False


feast = lambda beast, dish: beast[-1::1 - len(beast)] == dish[-1::1 - len(dish)]


feast = lambda s, d: (s[0], s[-1]) == (d[0], d[-1])


def feast(beast, dish):
	a = beast[0]
	b = beast[len(beast) - 1]
	c = dish[0]
	d = dish[len(dish) - 1]
	if a.lower() == c.lower() and b.lower() == d.lower():
		return True
	else:
		return False


def feast(beast, dish):
	return beast.startswith(dish[:1]) & beast.endswith(dish[-1])


def feast(beast, dish):
	return True if beast[::len(beast) - 1] == dish[::len(dish) - 1] else False


def feast(beast, dish):
	res = False
	return beast[0] == dish[0] and beast[len(beast) - 1] == dish[len(dish) - 1]


def feast(beast, dish):
	print(beast, dish)
	return beast[0] + beast[-1] == dish[0] + dish[-1]


def feast(beast, dish):
	return ''.join(beast.split())[0] == ''.join(dish.split())[0] and ''.join(beast.split())[-1] == ''.join(dish.split())[-1]


def feast(beast, dish):
	for char in beast:
		if beast[0] == dish[0] and beast[-1] == dish[-1]:
			return True
		else:
			return False


def feast(beast, dish):
	a = beast[0] + beast[-1]
	b = dish[0] + dish[-1]
	return a == b


def feast(beast, dish):
	(bf, bl) = (beast[0], beast[-1])
	(df, dl) = (dish[0], dish[-1])
	return (bf, bl) == (df, dl)


def feast(beast, dish):
	beastList = list(beast)
	dishList = list(dish)
	if beastList[0] == dishList[0] and beastList[-1] == dishList[-1]:
		return True
	else:
		return False


def feast(beast, dish):
	x = ''.join((c for c in beast.split(' ')))
	y = ''.join((c for c in dish.split(' ')))
	return y[0] == x[0] and y[-1] == x[-1]


def feast(beast, dish):
	return True if beast[0] == dish[0] and beast[-1] == dish[-1] else False
feast('brown bear', 'bear claw')


def feast(beast, dish):
	return all((beast[i] == dish[i] for i in (-1, 0)))


def feast(beast: str, dish: str) -> bool:
	return True if dish.startswith(beast[0]) and dish.endswith(beast[-1]) else False


def feast(beast, dish):
	first = beast[0]
	last = beast[-1]
	first1 = dish[0]
	last1 = dish[-1]
	if first == first1 and last == last1:
		return True
	else:
		return False


def feast(beast, dish):
	if beast[0] == dish[0] and beast[-1] == dish[-1]:
		return True
	elif beast[0] != dish[0] or beast[-1] != dish[-1]:
		return False


def feast(beast, dish):
	beast.replace(' ', '')
	beast_ls = [x for x in beast]
	dish.replace(' ', '')
	dish_ls = [x for x in dish]
	if beast_ls[0] == dish_ls[0] and beast_ls[-1] == dish_ls[-1]:
		return True
	else:
		return False


def feast(beast, dish):
	firstletter = beast[0]
	lastletter = beast[-1]
	firstletterdish = dish[0]
	lastletterdish = dish[-1]
	return (firstletter, lastletter) == (firstletterdish, lastletterdish)


def feast(beast, dish):
	animalbegin = beast[0]
	animalend = beast[len(beast) - 1]
	dishbegin = dish[0]
	dishend = dish[len(dish) - 1]
	if animalbegin == dishbegin and animalend == dishend:
		return True
	return False


def feast(b, d):
	result = False
	if d[0] == b[0] and d[-1] == b[-1]:
		result = True
	return result


def feast(beast, dish):
	b_list = list(beast)
	d_list = list(dish)
	if b_list[0] == d_list[0] and b_list[-1] == d_list[-1]:
		return True
	else:
		return False


def feast(beast, dish):
	(fbeast, lbeast) = (beast[0], beast[-1])
	(fdish, ldish) = (dish[0], dish[-1])
	return fbeast == fdish and lbeast == ldish


def feast(beast, dish):
	for i in beast:
		if beast[0] == dish[0]:
			if beast[-1] == dish[-1]:
				return True
			else:
				return False
		else:
			return False


def feast(beast, dish):
	lower1 = beast.lower()
	lower2 = dish.lower()
	list1 = lower1[0]
	list2 = lower2[0]
	list3 = lower1[-1]
	list4 = lower2[-1]
	if list1 == list2 and list3 == list4:
		return True
	else:
		return False


feast = lambda beast, dish: beast.startswith(dish[0]) and beast.endswith(dish[-1])


def feast(beast, dish):
	(f, s) = (beast[0], beast[-1])
	return dish[0] == f and dish[-1] == s


def feast(beast, dish):
	x = beast[0]
	y = dish[0]
	z = beast[-1]
	k = dish[-1]
	if x == y and z == k:
		return True
	else:
		return False


def feast(beast, dish):
	pass
	indexBeast = len(beast)
	indexDish = len(dish)
	beast1 = beast[0]
	beastLast = beast[indexBeast - 1]
	dish1 = dish[0]
	dishLast = dish[indexDish - 1]
	if beast1 == dish1 and beastLast == dishLast:
		return True
	else:
		return False


def feast(beast, dish):
	bfirst = beast[0]
	blast = beast[-1]
	dfirst = dish[0]
	dlast = dish[-1]
	if bfirst == dfirst and blast == dlast:
		return True
	else:
		return False


def feast(beast, dish):
	start = beast.startswith(dish[0])
	finish = beast.endswith(dish[-1:])
	if start and finish:
		return True
	return False


def feast(b, d):
	x = [b[0], b[len(b) - 1]]
	y = [d[0], d[len(d) - 1]]
	return x == y


def feast(beast, dish):
	start = beast.startswith(dish[:1])
	end = beast.endswith(dish[-1:])
	return start and end


def feast(beast, dish):
	beast = beast.lower()
	dish = dish.lower()
	if beast[-1] == dish[-1] and beast[0] == dish[0]:
		return True
	else:
		return False
feast('Faris', 'Mangos')


def feast(beast, dish):
	is_valid = True
	if beast[0] == dish[0] and beast[len(beast) - 1] == dish[len(dish) - 1]:
		is_valid = True
		return is_valid
	else:
		is_valid = False
		return is_valid


def feast(beast, dish):
	a = beast[0]
	b = beast[-1]
	c = dish[0]
	d = dish[-1]
	if a == c:
		if b == d:
			return True
		else:
			return False
	elif a != c:
		return False


import unittest

def feast(beast, dish):
	return True if beast[0] == dish[0] and beast[-1] == dish[-1] else False

class TestFeast(unittest.TestCase):

	def test_should_return_false_when_given_first_char_and_end_char_of_beast_name_is_not_same_with_dish(self):
		(beast, dish) = ('brown bear', 'bear claw')
		actual = feast(beast, dish)
		self.assertEqual(actual, False)

	def test_should_return_true_when_given_first_char_and_end_char_of_beast_name_is_same_with_dish(self):
		(beast, dish) = ('great blue heron', 'garlic naan')
		actual = feast(beast, dish)
		self.assertEqual(actual, True)


def feast(beast, dish):
	l1 = len(beast) - 1
	l2 = len(dish) - 1
	return beast[0] == dish[0] and beast[l1] == dish[l2]