7. reverse - it's working but giving an error 'message'


#1



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


Error message I got was: Your function fails on reverse("Python!"). It returns "None" when it should return "!nohtyP".


My code actually gave me the expected answer... with the error...??!!
I don't understand why I got error message.


def reverse(text):
    result = {}
    x = len(text)-1
    
    for i in range(len(text)):
        result[i] = text[(i-x)*(-1)]
    final = "".join(result.values())
    print final,


#2

hi , do not use "print",use "return".hope it can do some help for you.


#3

Thanks for your comment.
It's working now! :slight_smile:


#4

you are welcome!:slight_smile:


#5

This is the first exercise where I didn't even know how to start lol


#6

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