Reverse - Code apparently works, but Codecademy doesn't approve it


#1

Hello everyone!

I'm in lesson 'reverse' (link below) and my code apparently is working, as I tested it and got the correct results on the console, but Codecademy doesn't approve it.
https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/1

This is my code:

def reverse(text):
    result = ""
    n = len(text) - 1
    for char in text:
        result += text[n]
        n -= 1
    print result

and this is the error message I get:

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

Is this a bug? Or my code is indeed incorrect in someway?

Thanks in advance!


#2

you print the reversed string, you should return it


#3

Thanks for the prompt help, stetim!


#4