2 ms·
For simple mathematical operations you can import them as functions: from operator import mul, add arr = [1, 2, 3] sum_of_squares = reduce(add, map
by hcrisp 10y ago
For simple mathematical operations you can import them as functions:
from operator import mul, add
arr = [1, 2, 3]
sum_of_squares = reduce(add, map(mul, arr, arr))