My code prints out the correct output but I keep getting the error :

Oops, try again. Your function fails on reverse("Python!"). It returns "!nohtyPcba!nohtyP" when it should return "!nohtyP".

even when I get rid of the print line it still says there is an 'abc' some how stuck on to the end of "Python!" and I have no idea how to fix that since it doesn't seem to be in my code

m = []
def reverse(text): 
    i = 0
    count = (len(text)-1)
    while i < len(text):
        count -= 1
        i += 1
    return ''.join(m)
print reverse("Python!")


The list needs to be reset at the start of each call, so write this line just inside the function.


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