Stuck On Reverse


#1

I'm not quite sure where I went wrong on this one...


def reverse(text):
    le = len(text) - 1 
    reverse_letters = []
    s = ''
    while le < -1:
        reverse_letters.append(text[le])
        le -= 1
    return s.join(reverse_letters)

I keep getting error Your function fails on reverse("Python!"). It returns "" when it should return "!nohtyP".


#2

Did you mean to write,

while le > -1:

?


#3

Thank you so much... I feel kinda stupid now, sometimes it's the simplest things.


#4

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