[Python] itertools module
accumulate(iterable[, func, *, initial=None]) This function makes an iterator that returns accumulated sums, or accumulated results of other binary functions. The default func is operator.add function. from itertools import accumulate import operator print(list(accumulate([1, 2, 3, 4]))) # [1, 3, 6, 10] print(list(accumulate([1, 2, 3, 4], operator.mul))) # [1, 2, 6, 24] print(list(accumulate([1,..
2021. 5. 15.