Skip to content

Instantly share code, notes, and snippets.

@maryrosecook
Created November 11, 2013 19:28
Show Gist options
  • Select an option

  • Save maryrosecook/7418874 to your computer and use it in GitHub Desktop.

Select an option

Save maryrosecook/7418874 to your computer and use it in GitHub Desktop.
FP
@LeslieK
Copy link

LeslieK commented Nov 11, 2013

def average_height(people):
people_with_heights = filter(lambda x: 'height' in x, people)
heights = map(lambda x: x['height'], people_with_heights)
total = reduce(lambda acc, x: acc + x, heights, 0)
return total/len(heights)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment