Expected Ending
This kind of check is useful in real code when you need to know whether a file has the right extension or a string has the expected ending. Write a function solution that checks whether the string st ends with the substring ending. Return True if it does, otherwise return False.
Примеры
Ввод
"abc", "bc"Вывод
TrueВвод
"abc", "d"Вывод
FalseВвод
"sumo", "omo"Вывод
FalseНужно реализовать
def solution(st: str, ending: str) -> bool:
Теги
strings
Idħol biex tara l-istorja tas-sottomissjonijiet
IdħolIdħol biex tuża l-Mentor tal-AI
IdħolVisible tests
1
Input
"abc", "bc"Expected
True2
Input
"abc", "d"Expected
False3
Input
"sumo", "omo"Expected
False4
Input
"abc", ""Expected
True5
Input
"samurai", "rai"Expected
True6
Input
" ", "omo"Expected
FalseFocus radio
Paused · SomaFM · Fluid