Skip to content

Instantly share code, notes, and snippets.



Last active May 20, 2016
What would you like to do?
# coding: UTF-8
# Python3では、reduce関数はコア関数ではない。ので、importが必要。
from functools import reduce
def add(x, y):
return x + y
print(reduce(add, range(1, 5))) # 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment