Problem with Exercise: "reverse"


#1



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

So, this code appears to work perfectly; when I execute it, it prints "!nohtyP" as it should. The website, however, tells me:

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

So what's wrong here? Is this my code or some flaw in how the website is reading it?


def reverse(text):
    a=[]
    s = ""
    for char in text:
        a.insert(0, char)
    print s.join(a)

reverse("Python!")


#2

Hello @cloudace95799,

while your function prints the result, it doesn't return it. Instead of using the print statement with your result, use the return statement instead...