Without passing judgement, the first rule of coding is to never use code we do not understand.
To understand how this code works we need to examine the
range() function. It returns an iterable given a start index, a stop index, and a step interval.
We wish this range to iterate from the last to the first letter in text, so the start index will be,
len(text) - 1
since the last index is always one less than the length.
The stop index given in the range argument is exclusive meaning it is not included in the range iterator. We need the stop index to be
0 since that is the index of the first letter in text. Since the stop is not included, we must proceed one more to the left of zero, hence,
The step takes its direction from the sign on the given interval. A negative sign means right to left.
range(len(text) - 1, -1, -1)
Iterates from the last to the first, working from right to left.