Basic example
Input
extract_substring('hello', 1, 3)
Output
ell
Characters at indices 1..3 are 'e','l','l' -> 'ell'.
Full lesson preview
Return a substring from a string given start and end indices (inclusive), handling negative and out-of-range indices gracefully.
Problem statement
Task
Examples
Input
extract_substring('hello', 1, 3)
Output
ell
Characters at indices 1..3 are 'e','l','l' -> 'ell'.
Input format
Output format
Constraints
Samples
Input
extract_substring('python', -3, -1)
Output
hon
Indices -3..-1 correspond to 'h','o','n'.