Next Index Previous

Python Examples

26. reduce() function example.

from functools import reduce

nums = [5,3,9,4]

def sum(a,b):
	return a+b

print(reduce(sum,nums))

Output :
21



Father of Python Language

Guido-van-Rossum

Guido van Rossum

Born: January 31, 1956, Netherlands