Index out of range

I want to print string hello in reverse order using for loop with range, I don’t know why it’s showing out of range error. I don’t think I’ve done something wrong.

can anyone clear the logic flaw that I might be facing

Range starts from the first value, and arrive to the second (not included).
What’s the first value? Does the string has something at that index?

No, the string has nothing at that index. Now I get it, thanks

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