Python string index out of range - How to fix IndexError
In Python, String index out of range (IndexError) occurs when we try to access index which is out of the range of a string or we can say length of string. Python strings are zero-indexed, which means first character is at index 0, second at 1, and so on. For a string of length n, valid range will is