Reverse with list


#1

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?

https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/1?curriculum_id=4f89dab3d788890003000096#

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


#2

here:

z = len(x)

where does x come from?


#3

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