Use it like this.
Use reduce function
from functools import reduce
def reduce_func(n1, n2):
return n1 + n2 data_list = [2, 7, 9, 21, 33]
x = reduce(reduce_func, data_list)
print(x)
Use it like this.
from functools import reduce
def reduce_func(n1, n2):
return n1 + n2 data_list = [2, 7, 9, 21, 33]
x = reduce(reduce_func, data_list)
print(x)