Reverse with list


Hi Pythagorians!,

What's wrong with my code...thanks..Is it better to create and empty string or use a list for this in this instance?

This is the error message:

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

def reverse(text):
    x = []
    z = len(x)
    while z > 0:
        print x[z]
        z -= 1
    return text



z = len(x)

where does x come from?


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