7. reverse


#1



I am having issues with 7. reverse.

The error message tells me that I am returning "!nohtyP" instead of "!nohtyP"

I have no clue what went wrong as the above is not a typo but the error message telling me that my answer is wrong and saying it should be the same exact thing.


def reverse(text):
    txet = " "
    n = len(text) - 1
    while n > -1:
        txet += text[n]
        n -= 1
    return txet


#2

You need to have a better look at the error message. It says:

Your function fails on reverse("Python!"). It returns " !nohtyP" when it should return "!nohtyP".

Notice the space in front of your result. I think you know how to get rid of it, right? :smiley:


#3

Thank you. The background was messing with my eyes.


#4

I have tried to use append in order to create the reverse word but it won't work...

def reverse(word):
drow = []
position = len(word)
for n in range(position -1 , 0):
drow.append(word[n])

return drow

i believe it should have a way to make it this way... keep getting [] as result...