Math Functions
math.sumprod()
Sum pairwise products of equal-length iterables. Added in 3.12; float inputs use extended-precision intermediates.
Formal Syntax & Structure
python syntaxpython
math.sumprod(p, q, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| p | iterable of numbers | Numeric operands from the first iterable. |
| q | iterable of numbers | Numeric operands from the second iterable, of equal length. |
Return Value
number
Numeric result; concrete type depends on inputs.
Working Example
Example Snippetpython
import mathprint(math.sumprod([1, 2, 3], [4, 5, 6]))