← Back to Strings
Question 28
Starts With A Prefix
Starts With A Prefix
Read a word and a prefix and print exactly Yes when the word begins with the prefix and No otherwise, without any string method: slice the word from 0 to len(prefix) and compare that slice with the prefix using ==. Input: two lines, the word then the prefix, 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.