Reverse. Code should work but it didn't


#1

Why does it not work?
I get that error message:

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

I tried my code in another Pyhton console and it works. But not in codecademy.

liste=[]
liste2=[]
def reverse(text):
    for i in text:
        liste.append(i)
    wort=len(liste)
    for i in liste:
        liste2.append(liste[wort-1])
        wort-=1
    return "".join(liste2)

#2

the exercise calls only the function, not the whole script, place the empty list inside the function so there won't "leftovers" from earlier function calls


#3

Thank you.
I found that mistake just in that moment also :wink: