7. Reverse


I get this error message: Oops, try again. Your function fails on reverse("Python!"). It returns " !nohtyP" when it should return "!nohtyP".
Where am I wrong?

isn't those two strings the same?

def reverse(text):
    resp = " "
    for i in range(len(text)-1, -1, -1):
        resp += text[i]
    return resp


I have the same problem too, maybe a bug?


I already find the error, redefining resp = "" at line 2 fixed it.


resp = " " gives a space that won't get the exact result


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.