Sum and product of an array: Difference between revisions

→‎{{header|Python}}: or with numpy module
(→‎{{header|Python}}: or with numpy module)
Line 478:
reduce(add, numbers)
reduce(mul, numbers)
 
Or with ```numpy``` module:
 
{{libheader|numpy}}
from numpy import r_
numbers = r_[1:4]
total = numbers.sum()
product = numbers.prod()
 
=={{header|Raven}}==
Anonymous user