Documentation for a fictional module:
weird.reverse(text, [start, [end]])
Returns a copy of text reversed in the range start to end.
If the optional arguments start and end are specified, this function reverses the slice
text[start:end]
, but leaves the text outside of the slice unchanged. For example:>>> weird.reverse('abCDEfg',2,5) 'abEDCfg'
If either start or end are not specified, then the reversed slice starts at the beginning of the string, or ends at the end of the string, respectively. For example:
>>> weird.reverse('abCDEfg',2) 'abgfEDC'
Parameters:
text (str) – The text to (partially) reverse start (int) – The start of the slice to reverse end (int) – The end of the slice to reverse Returns:
A copy of text reversed in the range start to end.Return type:
str
Question: What do these expressions return?
weird.reverse('abcef',-3)
weird.reverse('abcef',end=2)
I have banged my head over and over.