You can return a portion of a string from some index onwards by using the bracket operator and and the expression index:. For example: if color = 'blue' then color[1:] = 'lue' since the result is all of the characters in color from the index onwards. Create a function called after_index() that accepts a string and a number n as parameters and returns a string consisting of the characters from the index to the end of the string.

Call |
Expected |
Received |
Correct |
after_index('red',1) |
ed |
ed |
true |
after_index('blue',2) |
ue |
ue |
true |
after_index('blue',4) |
|
|
true | |
댓글