I have to find the average of a list in Python. This is my code so far
l = [15, 18, 2, 36, 12, 78, 5, 6, 9] print reduce(lambda x, y: x + y, l)
I want to add just another approach
import itertools,operator list(itertools.accumulate(l,operator.add)).pop(-1) / len(l)