Correct output but i get error


#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".

why do i get that error even though output is correct

def reverse(text):
    length = len(text)
    while length>0:
        print text[length-1]
        length-=1
reverse("Python!")


#2

you need to return the reversed string


#3

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