7 python! is giving me troubles


#1

So I somehow made it to a working code, probably the hardest way to make it lol, but it works, trouble is that when its tested with "Python!", the "!" messes the whole thing up
my code is:

def reverse(texto):
    palabra = str(texto)
    valor_letra = len(palabra)
    letras = {}
    reversa = ""
    for key in (palabra):
        valor_letra -= 1
        letras[valor_letra] = "%s" %key

    for key in letras:   
        reversa += "%s" %letras[key]


    print reversa
    return reverse

reverse("Hola")

Its spanish, but you shouldnt have troubles with it

The error message says the code returns "function reverse at 0x7eff38674938" instead of "!nohtyP"


#2

@blogpro18646,

In your reverse() Method
instead of return reverse
use

return reversa

As the call of your reverse() Method return's a Value
change the call into

print reverse("Hola")

#3

Thank you very much n.n


#4

A post was split to a new topic: How can I reset the lesson to start from lesson 1