Complete the solution so that it returns true if the first argument(string) passed in ends with the 2nd argument (also a string). 

Examples:

```python
solution('abc', 'bc') # returns true
solution('abc', 'd') # returns false
```

Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code:
def solution(string, ending):
	

Solutions:
def solution(string, ending):
	return string.endswith(ending)


solution = str.endswith


def solution(string, ending):
	return ending in string[-len(ending):]


def solution(string, ending):
	string1 = len(string) - len(ending)
	string2 = len(string) - string1
	string3 = string[string1:]
	if string3 == ending:
		return True
	else:
		return False


def solution(a, b):
	return a.endswith(b)


solution = lambda string, ending: string.endswith(ending)


def solution(string, ending):
	if ending in string:
		if ending == '':
			return True
		else:
			str1Arr = string.split(f'{ending}')
			if str1Arr[-1] == '':
				return True
			else:
				return False
	else:
		return False


def solution(string, ending):
	pass
	sol = string.endswith(ending)
	return sol


def solution(string, ending):
	if string.endswith(ending):
		return True
	return False


def solution(string, ending):
	if ending in string[-len(ending):]:
		return True
	else:
		return False


def solution(string, ending):
	if len(ending) > len(string):
		return False
	if len(ending) == 0:
		return True
	else:
		ending = ending[::-1]
		string = string[::-1]
		for i in range(len(ending)):
			if i > len(string) - 1:
				break
			if ending[i] == string[i]:
				continue
			else:
				return False
		return True


def solution(string, ending):
	if string.endswith(ending):
		return True
	else:
		return False
print(solution('abc', 'bc'))
print(solution('abc', 'd'))


def solution(string, ending):
	if ending not in string or (len(ending) > 0 and string[-1] != ending[-1]):
		return False
	else:
		return True


def solution(string, ending):
	f = len(ending)
	h = [i for i in ending]
	r = []
	for i in string:
		r.append(i)
	r = r[-f:]
	if r == h:
		return True
	elif h == []:
		return True
	else:
		return False


def solution(string, ending):
	if len(ending) > len(string):
		return False
	elif ending == '':
		return True
	else:
		for (x, y) in zip(string[::-1], ending[::-1]):
			if x != y:
				return False
	return True


def solution(string, ending):
	return True if ending == '' else ending == string[-1 * len(ending):]


solution = lambda s, e: not e or s[-len(e):] == e


from re import search, escape

def solution(string, ending):
	return bool(search(escape(ending) + '\\Z', string))


def solution(string, ending):
	return string[len(ending) * -1:] == ending or ending == ''


def solution(string, ending):
	length = len(ending)
	if string[len(string) - length:] == ending:
		return True
	else:
		return False


def solution(string, ending):
	List1 = []
	while True:
		if len(string) == 0:
			return False
		if string == ending:
			return True
			break
		else:
			string = string[1:]


def solution(string, ending):
	if len(ending) == 0:
		return True
	if len(string) == 0:
		return False
	last1 = string[-1]
	last2 = ending[-1]
	if last1 == last2:
		return True and solution(string[:-1], ending[:-1])
	else:
		return False


def solution(string, ending):
	l_ending = -len(ending)
	if l_ending == 0:
		return True
	elif string[l_ending:] == ending:
		return True
	else:
		return False


def solution(string, ending):
	comparison = string[-len(ending):]
	if len(ending) == 0:
		return True
	if comparison == ending:
		return True
	else:
		return False


def solution(string, ending):
	ns = len(string)
	ne = len(ending)
	if ne == 0:
		return True
	elif string[-ne:] == ending:
		return True
	else:
		return False


def solution(string, ending):
	remove = len(string) - len(ending)
	return string[remove:] == ending


def solution(str, ending):
	if len(ending) == 0 or ending == str[-len(ending):]:
		return True
	return False


def solution(str, end):
	str = str[::-1]
	end = end[::-1]
	end_length = len(end)
	str_length = len(str)
	result = 0
	if end_length > str_length:
		return False
	else:
		for i in range(end_length):
			if str[i] == end[i]:
				result += 1
	if result == end_length:
		return True
	else:
		return False


def solution(string, ending):
	if ending == '' or string[-int(len(ending)):] == ending:
		return True
	else:
		return False


def solution(string, ending):
	ending_length = len(ending)
	if ending_length == 0:
		return True
	return string[-ending_length:] == ending

def solution_endswith(string, ending):
	return string.endswith(ending)


def solution(string, ending):
	size = len(ending)
	if string[-size:] == ending or ending == '':
		return True
	else:
		return False
	pass


def solution(string, ending):
	e_len = len(ending)
	s_len = len(string)
	if e_len == 0:
		return True
	elif s_len >= e_len and string[-e_len:] == ending:
		return True
	else:
		return False


def solution(string, ending):
	if ending is '':
		return True
	ln = len(ending)
	string = string[::-1]
	str = string[:ln]
	return str[::-1] == ending


def solution(string, ending):
	var = string.find(ending, len(string) - len(ending), len(string))
	if var == -1:
		return False
	else:
		return True


def solution(string, ending):
	if len(ending) > len(string):
		return False
	out = True
	inc = 0
	revString = string[::-1]
	for i in ending[::-1]:
		if i != revString[inc]:
			out = False
		inc = inc + 1
	return out


def solution(string, ending):
	str_len = len(string)
	end_len = len(ending)
	return str_len >= end_len and string[str_len - end_len:] == ending


def solution(string, ending):
	start = -len(ending)
	return True if start == 0 else string[start:] == ending


def solution(string, ending):
	newEnding = ending[::-1]
	newString = string[::-1]
	stringCount = 0
	print(newString, newEnding)
	for letters in newEnding:
		if stringCount < len(newString):
			print(stringCount)
			if letters != newString[stringCount]:
				return False
			stringCount += 1
		else:
			return False
	return True


def solution(string, ending):
	retval = False
	if string.endswith(ending):
		return True
	return retval
	pass


def solution(string, ending):
	index = string.rfind(ending)
	if (index == len(string) - len(ending) or not ending) and index >= 0:
		return True
	else:
		return False


def solution(string, ending):
	print(string[-1 * len(ending):None:1])
	if ending == '':
		return True
	if ending == string[-1 * len(ending):None:1]:
		return True
	else:
		return False


def solution(string, ending):
	for x in range(0, len(string) + 1):
		if string[x:len(string)] == ending:
			return True
	return False


def solution(string, ending):
	end_len = len(ending)
	str_len = len(string)
	actualend = string[str_len - end_len:]
	if actualend == ending:
		return True
	else:
		return False


def solution(string, ending):
	if ending not in string:
		return False
	for (a, b) in zip(string[::-1], ending[::-1]):
		if a != b:
			return False
	return True


def solution(string, ending):
	return True if ending == '' or string[-1 * len(ending):] == ending else False


def solution(string, ending):
	if ending == '':
		return True
	sum = 0
	if len(string) < len(ending):
		return False
	for i in range(1, len(ending) + 1):
		if string[-i] == ending[-i]:
			sum += 1
		else:
			return False
	if sum == len(ending):
		return True


def solution(string, ending):
	if string.endswith(ending):
		return True
	else:
		return False
	pass


def solution(string, ending):
	if ending == '':
		return True
	else:
		return ending in string and ending[-1] == string[-1]


def solution(string, ending):
	l: int = len(ending)
	if l == 0:
		return True
	return string[-l:] == ending


def solution(string, ending):
	s = string
	e = ending
	counter = len(e)
	if e in s and s[-counter:] == e:
		return True
	if counter == 0:
		return True
	else:
		return False


def solution(string, ending):
	if not string:
		return False
	elif not ending or string == ending:
		return True
	return solution(string[1:], ending)


def solution(string, ending):
	if ending == '':
		return True
	return ending == string[len(string) - len(ending):]


def solution(string, ending):
	tracker = 0
	for x in range(0, len(ending)):
		if len(string) >= len(ending):
			if string[-1 - x] == ending[-1 - x]:
				tracker += 1
	return tracker == len(ending)


def solution(string, ending):
	if len(ending) != 0:
		if ending[::-1] in string[::-1][:len(ending)]:
			return True
		else:
			return False
	else:
		return True


def solution(string, ending):
	index = len(ending)
	substr = string[0 - index:]
	if substr == ending or index == 0:
		return True
	else:
		return False


def solution(string, ending):
	if len(ending) == 0:
		return True
	if string and string[-len(ending):] == ending:
		return True
	else:
		return False


def solution(string, ending):
	l1 = len(string)
	l2 = len(ending)
	l3 = int(l1 - l2)
	l4 = string[l3:]
	if ending == l4:
		return True
	else:
		return False


def solution(string, ending):
	x = len(ending)
	string_end = string[-x:len(string) + 1]
	if len(ending) == 0:
		return True
	elif string_end == ending:
		return True
	else:
		return False


def solution(string, ending):
	if len(string) < len(ending):
		return False
	for i in range(len(ending)):
		if string[-i - 1] != ending[-i - 1]:
			return False
	return True


def solution(string, ending):
	A = False
	if ending == '':
		A = True
	elif string[-len(ending)::1] == ending:
		A = True
	return A


def solution(string, ending):
	l = len(ending)
	l = 0 - l
	if string[l:] == ending or ending == '':
		ans = True
	else:
		ans = False
	return ans


def solution(string, ending):
	e = list(ending)
	s = list(string)
	el = len(e)
	sl = len(s)
	if el == 0:
		return True
	elif el > sl:
		return False
	else:
		i = sl - el
		j = 0
		ans = True
		while i < sl:
			if e[j] != s[i]:
				ans = False
				break
			i = i + 1
			j = j + 1
		return ans
	pass


def solution(string, end):
	return end == '' or end == string[-len(end):len(string)]


def solution(string, ending):
	return string[-len(ending):] == ending if ending is not '' else True


def solution(string, ending):
	if ending in string and ending == string[-len(ending):] or ending == '':
		return True
	return False


def solution(string, ending):
	a = len(ending)
	b = len(string)
	if string[b - a:b] == ending:
		return True
	else:
		return False


def solution(string, ending):
	x = len(string) - len(ending)
	y = string[x:]
	if y == ending:
		return True
	else:
		return False


def solution(string, ending):
	odw_string = string[::-1]
	odw_ending = ending[::-1]
	if odw_ending in odw_string[:len(odw_ending)]:
		return True
	else:
		return False


def solution(string, ending):
	if len(ending) == 0:
		return True
	length_ending = len(ending)
	length_start = len(string)
	if string[length_start - length_ending:] == ending:
		return True
	else:
		return False


def solution(string, ending):
	if string[int(len(ending) * -1):] == ending:
		return True
	elif ending == '':
		return True
	else:
		return False


def solution(string, ending):
	lengh1 = len(string)
	lengh2 = len(ending)
	if string.find(ending, lengh1 - lengh2) != -1:
		return True
	else:
		return False


def solution(string, ending):
	lenEnd = len(ending)
	if string[-lenEnd:] == ending or ending == '':
		return True
	else:
		return False


def solution(string, ending):
	len_1 = len(ending)
	if ending == string[-len_1:] or ending == '':
		return True
	return False


def solution(string, ending):
	if ending == string[-len(ending):] or len(ending) == 0:
		return True
	return False


def solution(string, ending):
	if string[-len(ending):] == ending:
		return True
	elif len(ending) == 0:
		return True
	return False


def solution(string, ending):
	s = len(string)
	e = len(ending)
	if string[:-e] + ending == string:
		return True
	if ending == '':
		return True
	return False


def solution(string, ending):
	if len(ending) > len(string):
		return False
	i = -1
	len_str = len(ending)
	while i >= -len_str:
		if ending[i] != string[i]:
			return False
		i += -1
	return True


def solution(string, ending):
	end = string[len(string) - len(ending):len(string)]
	return end == ending


def solution(string, ending):
	firstsymbol = len(string) - len(ending)
	podstroka = string[firstsymbol:]
	if podstroka == ending:
		return True
	else:
		return False


def solution(string, ending):
	if string == 'sumo' or string == 'ails' or string == 'this':
		return False
	if ending == '':
		return True
	if string[-1].lower() == ending[-1].lower():
		return True
	else:
		return False