Strings, slices, and formatting

Which characters does this slice return?

Examples

Worked example

Input
'green'[1:4]
Expected output
ree

Hints and solution

Hint 1

Write down the starting state and walk through one example by hand.

Reveal worked answer

The characters at positions 1, 2, and 3 are r, e, and e. The character at position 4 is excluded.

Back to the lesson