1import functools 2import operator 3 4 5l = [1, 2, 3] 6r = functools.reduce(operator.add, l) 7print(r) 8 9