DESCRIPTION:
Complete the solution so that it returns true if the first argument(string) passed in ends with the 2nd argument (also a string).
Examples:
solution('abc', 'bc') # returns true
solution('abc', 'd') # returns false
def solution(string, ending):
print(string)
print(ending)
if ending=="":
return True
leng=len(ending)
print(string[-leng:])
return string[-leng:]==ending
'알고리즘 문제 > CodeWar' 카테고리의 다른 글
Find the odd int (0) | 2022.09.21 |
---|---|
Persistent Bugger (0) | 2022.09.21 |
Sum of odd numbers (0) | 2022.09.20 |
Duplicate Encoder (0) | 2022.09.20 |
Are they the "same"? (0) | 2022.09.20 |