# Udacity – Intro to Computer Science – Python – Mean of Numbers

## 2 thoughts on “Udacity – Intro to Computer Science – Python – Mean of Numbers”

1. How about using lambda for this?

def list_mean(p):
return (reduce(lambda x,y: x+y*1.0, p)/len(p))

1. Johnny says:

If I knew lambda back then I would definitely use lambda – so yes great nice short code thanks! (it was only a year later I posted this I learnt about the JavaScript map, filter, and reduce – and then functional programming.)