By looping using:
for i in sq:
you are looping over the elements of sq.
If instead, you want the variable i to loop over the possible indexes of sq, you would generally loop over the range(len(sq)), so that you get values from 0 to len(sq) - 1.
for i in range(len(sq)):
However, in this case, you are wanting to assign to i inside the loop:
i += len(STR)
This will not have the desired effect if you are looping over the range(...) because on the next iteration it will be assigned to the next value from range, ignoring the increment that was added. In general, one should not assign a loop variable inside the loop.
So it would probably most easily be implemented with a while loop, and you set the desired value of i explicitly (i=0 to initialise, i+=1 before restarting the loop), and then you can have whatever other assignments you want inside the loop.
STR = "ell"
sq = "well, well, hello world"
counter = 0
i = 0
while i < len(sq):
if sq[i:i+len(STR)] == STR:
counter += 1
i += len(STR)
i += 1
print(counter) # prints 3
(You could perhaps save len(sq) and len(STR) in other variables to save evaluating them repeatedly.)
If you are a beginner and want to know more about Data Science the do check out the Data Science course