About Reverse



It says my code has the following error:Your code looks a bit off--it threw a "string index out of range" error. Check the Hint if you need help!

def reverse(text):
    for a in range(0,len(text)+1):
    return new


Have you had a look at which indexes you're using for text? What you'd do is print them out just before using them, and check whether they're valid. They're probably not, judging by the error, and once you've found what's wrong about the index you can reconsider how you went about computing it


The index I use for text is len(text)-a and a is in range(0,len(text)+1) in the loop. I don't know what's wrong..


Print them out and see for yourself if they're actually what they should be


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