Reverse


#1



is this code wrong?


def reverse(text):
    n=0
    while n<len(text):
        text[n]=text[len(text)-n]
        n+=1
    return text


#2

It works for the first letters, but not for the whole word.

Let's take the word "Car" for example.

In the first iteration the letter C will be replaced with r. Now the word is "rar".
In the second iteration a will be replaced with a, the word is still "rar".
In the third iteration the first letter will replace the last letter.
But the first letter was already replaced with the last letter, so the last letter will stay what it was. In the example "rar" will still be "rar".