Is this program correct?


def reverse(text):
l = len(text) - 1
for x in range(l,-1):
word = word + text[x]
return word
print reverse(“abcd”)

is this program correct for doing a reverse for a string


Our question back to you is, “Does it work?” If not, then there is your answer.

To reverse a range, we make the start value the highest index, the end value one less than zero (recall that range excludes the final value) and the stride negative one.

range(len(text) - 1, -1, -1)


thank you sir , ya now i understand it we need to stride back