Same Final Character
This check is useful when you need to quickly compare the endings of two strings, such as names, codes, or short labels. Write a function str_ends that takes two strings a and b. Return True if both strings end with the same character, otherwise return False.
Примеры
Ввод
"Hello", "Halo"Вывод
TrueВвод
"Hello", "Hi"Вывод
FalseВвод
"dog", "frog"Вывод
TrueНужно реализовать
def str_ends(a: str, b: str) -> bool:
Теги
strings
Jelentkezz be a beküldési előzmények megtekintéséhez
BejelentkezésJelentkezz be az MI-mentor használatához
BejelentkezésVisible tests
1
Input
"Hello", "Halo"Expected
True2
Input
"Hello", "Hi"Expected
False3
Input
"dog", "frog"Expected
True4
Input
"abc", "abz"Expected
False5
Input
"a", "a"Expected
True6
Input
"Hello, World!", "Hello, World!"Expected
TrueFocus radio
Paused · SomaFM · Fluid