Last active
December 17, 2015 01:29
-
-
Save HybridEidolon/5528321 to your computer and use it in GitHub Desktop.
python average int list inject
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
from functools import reduce | |
# nums = [1, 2, 3, 4] | |
def average_value(nums): | |
avg = reduce(lambda t,i: t+i, nums) | |
avg /= len(nums) | |
return avg | |
print average_value([1, 2, 3, 4]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment