Created
December 11, 2014 15:04
-
-
Save drio/a38b2ebb1871ec0bfcd0 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
# vim: set ts=4 sw=4 et foldmethod=indent paste: | |
# | |
# --- | |
people = [{'name': 'Mary', 'height': 160}, | |
{'name': 'Isla', 'height': 80}, | |
{'name': 'Sam'}] | |
hs = map(lambda o: o['height'], filter(lambda o: 'height' in o, people)) | |
sum_h = reduce(lambda a, o: a + o, hs, 0) | |
if sum_h > 0: | |
print str(sum_h/len(hs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment