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 had a similar question to solve in a Udacity´s problems. Instead of a built-in function i coded:
def list_mean(n): summing = float(sum(n)) count = float(len(n)) if n == []: return False return float(summing/count)
Much more longer than usual but for a beginner its quite challenging.