Reverse problem


#1


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


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


Code works fine in local spider File, and reverses text perfectly, but does not seem to work on here. Tips on mistakes i am making? Thanks :slight_smile:

Replace this line with your code. 

def reverse(text):
    reverselst=[]
    for char in text:
        reverselst.append(char)
    reverselst.reverse()
    
    for item in reverselst:
      return(item);


#2

In your loop you exit the whole function on each iteration, so there will only be one iteration, it's not a loop at all.


#3

Thanks! i'll adjust :slight_smile:


#4

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