Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Last active May 20, 2016 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/6e7a46cff9654e7c9cef5b2d085b1e8d to your computer and use it in GitHub Desktop.
Save chuck0523/6e7a46cff9654e7c9cef5b2d085b1e8d to your computer and use it in GitHub Desktop.
# 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