Created
November 11, 2013 19:28
-
-
Save maryrosecook/7418874 to your computer and use it in GitHub Desktop.
FP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| e |
Author
maryrosecook
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