← Back to Strings
Question 29
Last Three Characters
Last Three Characters
Read one word and print only its last three characters using the slice [-3:], which starts three positions from the end and runs to the end because the stop is left empty. Input: one line, a word of at least three characters, no prompt. The output is one line holding those characters.
Expected Output:
hon= newline. The output ends with a newline — print one after the last line.
Hints2 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.