My code throws the following error: Traceback (most recent call last):
File "python", line 11, in
File "python", line 6, in reverse
IndexError: string index out of range
def reverse(text): numSubtracted = 0 reverseText =  for char in text: while len(text) > numSubtracted: reverseText.append(text[len(text) - numSubtracted]) numSubtracted += 1 return str(reverseText) print reverse("code")
The idea for the code is that it adds to the list, the character in text that is in the index of the numSubtracted, which goes up by one each time, as long as the length of the text is greater. Then it prints the list as a string.
What am I doing wrong?