Skip to content

Instantly share code, notes, and snippets.

@HybridEidolon
Last active December 17, 2015 01:29
Show Gist options
  • Save HybridEidolon/5528321 to your computer and use it in GitHub Desktop.
Save HybridEidolon/5528321 to your computer and use it in GitHub Desktop.
python average int list inject
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