[Solved] Getting an error of substring not found for below code [closed]


You are asking Python to find e in an empty slice; the second and third argument are the start and end indices. s2[50:0] is an empty string:

>>> s2 = "fast and furious series from one to seven"
>>> s2[50:0]
''

If you wanted to find text by searching from the end, use the str.rindex() function:

>>> s2.rindex('e')
39

6

solved Getting an error of substring not found for below code [closed]