Reverse


#1



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

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


Am i doing wrong?it exactly reversed my text but the test was failed.


def reverse(text):
n=len(text)-1
x=[]

while n>=0 :
    x.append(text[n])
    n-=1

print"".join(x)

reverse("Python!")

`


#2

you function prints the reversed string, your function needs to return the reversed string


#3

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