Alright below is my code for this exersise. It works, yet i dont entirely understand why it works.
If i remove the line
reversed_text.append(text[-1:]) before the loop, and change variables letter and letter_2 to -1 and -2 respectively (in order to slice and the caracters one by one from the string and append them in the reverese order) nothing happens - the code only slices the last letter of a string. Yet when i slice out and append last symbol of the string, and go looping for the reamining - it works. Please explain this to me, it seems that i grabbed this intuitively yet i lack rational understanding.
text = raw_input() def reverse(text): reversed_text =  letter = -1 letter_2 = 0 reversed_text.append(text[-1:]) for n in range(len(text)): reversed_text.append(text[letter:letter_2]) letter -= 1 letter_2 -= 1 return ''.join(reversed_text) print reverse(text)