Some new animals have arrived at the zoo. The zoo keeper is concerned that perhaps the animals do not have the right tails. To help her, you must correct the broken function to make sure that the second argument (tail), is the same as the last letter of the first argument (body) - otherwise the tail wouldn't fit!

If the tail is right return true, else return false.

The arguments will always be strings, and normal letters.

Difficulty: EASY
Starter code: def correct_tail(body, tail):
	

Solutions:
def correct_tail(body, tail):
	return body.endswith(tail)


def correct_tail(body, tail):
	return body[-1] == tail


def correct_tail(body, tail):
	sub = body[len(body) - len(tail)]
	if sub == tail:
		return True
	else:
		return False


correct_tail = str.endswith


def correct_tail(body, tail):
	return True if body[-1] == tail else False


def correct_tail(b, t):
	return b[-1:] == t


correct_tail = lambda a, t: a[-1] == t


correct_tail = lambda b, t: b[-1] == t


correct_tail = lambda a, b: a[-1] == b


def correct_tail(body: str, tail: str) -> bool:
	return body[-1] == tail


def correct_tail(body, tail):
	b = body[-1:].lower()
	c = tail[0].lower()
	if b == c:
		return True
	else:
		return False
correct_tail('Fox', 'x')


correct_tail = lambda body, tail: body[-1] == tail[0]


def correct_tail(body, tail):
	n = len(body)
	if body[n - 1] == tail[0]:
		return True
	else:
		return False


def correct_tail(body, tail):
	x = body.split()
	y = body[-1]
	if y == tail:
		return True
	else:
		return False


def correct_tail(body, tail):
	x = len(body) - 1
	if tail == body[x]:
		return True
	else:
		return False


def correct_tail(body, tail):
	i = len(body) - len(tail)
	if body[i] == tail:
		return True
	else:
		return False


def correct_tail(body, tail):
	for i in body:
		if tail == body[-1]:
			return True
		else:
			return False


def correct_tail(body, tail):
	sub = body[-1]
	sub = str(sub)
	if sub == tail:
		return True
	else:
		return False


def correct_tail(body, tail):
	index = len(body) - 1
	last_letter = body[index]
	if last_letter == tail:
		return True
	else:
		return False


import unittest

def correct_tail(body, tail):
	last_char_of_body = body[-1]
	return True if last_char_of_body == tail else False

class TestCorrectTail(unittest.TestCase):

	def test_should_return_false_when_last_of_char_of_body_is_not_equal_tail(self):
		self.assertFalse(correct_tail(body='Emu', tail='m'))

	def test_should_return_true_when_last_of_char_of_body_is_equal_tail(self):
		self.assertTrue(correct_tail(body='Fox', tail='x'))


def correct_tail(body, tail):
	sub = body[-1]
	if sub == tail:
		result = True
	else:
		result = False
	return result


def correct_tail(b, t):
	if t == b[len(b) - 1]:
		return True
	else:
		return False


def correct_tail(body, tail):
	if body.endswith(tail):
		return True
	else:
		return False


def correct_tail(body, tail):
	if isinstance(body, str) and isinstance(tail, str) and (len(tail) > 0):
		if body[-1] == tail:
			return True
	return False


def correct_tail(body, tail):
	return list(body).pop() == tail


def correct_tail(body, tail):
	sub = body[-1].lower()
	return True if sub == tail else False


def correct_tail(body, tail):
	li = list(body)
	if li[-1] == tail:
		return True
	else:
		return False


correct_tail = lambda b, t: b[-1:] is t or b is t


correct_tail = lambda body, tail: body[-1:] == tail


def correct_tail(body, tail):
	total = len(body)
	last_n = total - 1
	last = body[last_n]
	if last == tail:
		return True
	else:
		return False


def correct_tail(body, tail):
	sub = body[len(body) - 1:body.rfind(tail) + 1]
	if tail == sub:
		return True
	else:
		return False


def correct_tail(body, tail):
	subs = body[len(body) - len(tail)]
	if subs == tail:
		return True
	else:
		return False


def correct_tail(body, tail):
	bool = False
	last = len(body)
	last = last - 1
	if body[last] == tail:
		bool = True
	return bool


def correct_tail(body, tail):
	sub = body[-1]
	if sub == tail:
		return True
	else:
		return False
print(correct_tail('Fox', 'x'))


def correct_tail(body, tail):
	animal = []
	for letter in body:
		animal.append(letter)
	if animal[-1] == tail:
		return True
	else:
		return False


def correct_tail(body, tail):
	if body[len(body) - 1] is tail:
		return True
	return False


def correct_tail(body: str, tail: str):
	return True if body[-1].lower() == tail.lower() else False


def correct_tail(body, tail):
	i = len(body) - 2
	sub = body[:i:-1]
	print(sub)
	if sub == tail:
		return True
	else:
		return False


def correct_tail(body, tail):
	body.lower()
	tail.lower()
	a = body[-1]
	if a == tail:
		return True
	else:
		return False


def correct_tail(body, tail):
	return 1 if body[-1] == tail else 0


def correct_tail(body, tail):
	list = body.split()
	sub = list[0][-1]
	if sub == tail:
		return True
	else:
		return False


import re

def correct_tail(body, tail):
	sub = re.sub('.', '', body, len(body) - len(tail))
	if sub == tail:
		return True
	else:
		return False


def correct_tail(body, tail):
	b = [str(x) for x in body[::-1]]
	t = [str(y) for y in tail[::-1]]
	return True if b[0] == t[0] else False


correct_tail = lambda body, tail: True if body[-1] == tail else False


def correct_tail(body, tail):
	sub = body[-1]
	if sub is tail:
		return True
	return False


def correct_tail(body, tail):
	bodyList = list(body)
	return bodyList[-1] == tail


def correct_tail(body, tail):
	index = [letter for letter in body]
	if index[-1] == tail:
		return True
	else:
		return False


def correct_tail(body, tail):
	if body == '':
		return False
	return body[-1] == tail


def correct_tail(body, tail):
	if body[-1] is not tail:
		return False
	else:
		return True


def correct_tail(body, tail):
	a = len(body) - 1
	if tail == body[a]:
		return True
	else:
		return False