Start New Discussion within our Software Development Community
"""Count nonoverlapping consecutive three digit numbers inside string
   without using modules

   """

s = '[@@@123124123123125@@@]'
f = next(n for n,c in enumerate(s) if c.isdigit())
numbers = (s for s in (''.join(x) for x in zip(s[f::3], s[f+1::3], s[f+2::3])) if s.isdigit())
counts = {}
for n in numbers:
    counts[n] = counts.setdefault(n, 0) + 1
print(counts)

Specialties:
IT/Science/Contracts/Religious translation/interpreting FIN-ENG-FIN
Python programming

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.