Skip to main content

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 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.

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.

# 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) 
deleted 5 characters in body
Source Link

strong textUse Use it like this.

Use reduce function

from functools import reduce

def reduce_func(n1, n2): return n1 + n2

return n1 + n2 

data_list = [2, 7, 9, 21, 33] x

x = reduce(reduce_func, data_list) print

print(x)

strong textUse 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.

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)

added 19 characters in body
Source Link

Usestrong textUse it like this.

Use reduce function

from functools import reduce def

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.

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)

strong textUse 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)

Source Link
Loading