How to use accumulate() to produce a cumulative series of characters in Python

1 Answer

0 votes
from itertools import *     

# {a,b,c,...}, are a, ab, abc, ...

print(list(accumulate('abcde')))



'''
run:

['a', 'ab', 'abc', 'abcd', 'abcde']

'''

 



answered May 24, 2019 by avibootz
...