This code works correctly as I saw it on another post. I have been trying to analyze why line 4 makes the code work but I am not certain why. If I remove the "-c" from the brackets the function will return the last letter of the word repeated the length of the original string. Can someone explain what is happening here in line 4?
def reverse(text): rev = "" for c in range(len(text)): rev += text[len(text)-1-c] return rev