Why doesn't this code work? 7/15reverse


#1



No idea why it doesn't work.
It works offline perfectly.
Is the interpreter broken?


It tell me : Oops, try again. Your code looks a bit off--it threw a "string index out of range" error. Check the Hint if you need help!


x = raw_input("Which word or phrase do you want reverse?:")
strlst = []
tmplst = []
def reverse(x):
  for e in x:
    strlst.append(e)
  le = len(strlst)
  for e in strlst:
    tmplst.append(x[le-1])
    le = le-1
  print "".join(tmplst)
  

reverse(x)


#2

for validation the exercise is going to call the function (just the function, not the whole script) multiply times, so you should declare your empty lists inside the function


#3

I was thinking that it was going to be the validation process.
Thank you for your help


#4