Check if String EndsWith in Python


The challenge

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

Examples:

strEndsWith('abc', 'bc') # returns true
strEndsWith('abc', 'd') # returns false

The solution in Python

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

Test cases to validate our solution

test.assert_equals(solution('abcde', 'cde'), True)
test.assert_equals(solution('abcde', 'abc'), False)
test.assert_equals(solution('abcde', ''), True)