why do we want to use reduce() in python code example
Example: reduce in python
'''try this'''
from functools import reduce
a = [1,2,3,4]
SUM = reduce(lambda n,n2:n+n2,a)
print(SUM)
'''try this'''
from functools import reduce
a = [1,2,3,4]
SUM = reduce(lambda n,n2:n+n2,a)
print(SUM)