Functional Programming Tools : Functional Programming : Function PYTHON examples


PYTHON examples » Function » Functional Programming »

 

Functional Programming Tools


Functional Programming Tools: reduce


"reduce(function, sequence)" returns a single value constructed by calling the 
# binary function function on the first two items of the sequence, then on the 
# result and the next item, and so on. For example, to compute the sum of the numbers 
through 10:

def add(x,y)return x+y

print reduce(add, range(111))


           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Function
» Functional Programming