Answers for "what is the reduce function python ?"

2

python reduce()

from functools import reduce
items = [1,2,3,4,5]
sum_all = reduce(lambda x,y: x + y, items)
 
print (sum_all) #15
Posted by: Guest on May-09-2020

Code answers related to "what is the reduce function python ?"

Python Answers by Framework

Browse Popular Code Answers by Language