7. reverse


Practice makes perfect 7. reverse

Hey everyone, this is my code and it's running and return the reverse of Python!, but I'm still getting this module failure:

Oops, try again. Your function fails on reverse("Python!"). It returns "['!', 'n', 'o', 'h', 't', 'y', 'P']" when it should return "!nohtyP".

I'm not sure if I just have formatting incorrect or what, which is most likely. Help!

a = "Python!"

def reverse(text):
    #to set x to last character in text
    x = len(text) - 1
    #empty string to append last character to
    t = []
    for i in text:
        x -= 1
    print ''.join(t)
    return t




print ''.join(t)

you join the list into a string, but you only print this. You should also return a string, not a list


Ah, yes, dummy me. So close, yet so far!

Thanks a bunch!