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
PostgreSQLv16

Šeit parādīsies koda izpildes rezultāts

Visible tests
1
Input
"Hello", "Halo"
ExpectedTrue
2
Input
"Hello", "Hi"
ExpectedFalse
3
Input
"dog", "frog"
ExpectedTrue
4
Input
"abc", "abz"
ExpectedFalse
5
Input
"a", "a"
ExpectedTrue
6
Input
"Hello, World!", "Hello, World!"
ExpectedTrue
Focus radio
Paused · SomaFM · Fluid