Jan-13-2022, 10:08 AM
(Jan-20-2018, 04:36 AM)Mekire Wrote:x = 0 for s,_ in enumerate(haystack): haysub = haystack[s:len(needle) + s] if haysub == needle: x += 1 print(x)
I seem to be not understanding something with how the loops work. Could you please elaborate in a simple manner why in line 4 you've used the +s part?
Thank you