Python
Programming Exercises, Gently Explained
113
mirrorIndex = len(text) - ____ - ____
text[i], text[mirrorIndex] = text[____], text[____]
# Join the list of strings into a single string and return it:
return ''.join(text)
The complete solution for this exercise is given in Appendix A and
https://invpy.com/reversestring.py. You can view each step of this program as it
runs under a debugger at
https://invpy.com/reversestring-debug/.