← Back to Strings
Question 45
Ends With A Suffix
Ends With A Suffix
Read a word and a suffix and print exactly Yes when the word ends with the suffix and No otherwise, without a string method: the tail to compare starts at len(word) - len(suffix), so slice from there to the end and test it with ==. Input: two lines, the word then the suffix, no prompts.
Expected Output:
Yes= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
StringsSlicing
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.