Counters
counter = 0
for i in n: # n is a list of items
if condition(i):
counter += 1
else:
counter -= 1counter = 0
while counter < len(s):
if condition(s[counter]):
counter += 1Last updated
counter = 0
for i in n: # n is a list of items
if condition(i):
counter += 1
else:
counter -= 1counter = 0
while counter < len(s):
if condition(s[counter]):
counter += 1Last updated