PyDocs

Nav

Python Runtime Services

sum

builtins

function
  • sum(iterable, /, start=0)
Return the sum of a 'start' value (default: 0) plus an iterable of numbers

When the iterable is empty, return the start value.
This function is intended specifically for use with numeric values and
may reject non-numeric types.
Changed in 3.8, 3.12, 3.14
  • 3.8: The start parameter can be specified as a keyword argument.
  • 3.12: Summation of floats switched to an algorithm that gives higher accuracy and better commutativity on most builds.
  • 3.14: Added specialization for summation of complexes, using same algorithm as for summation of floats.
0 Examples
No examples for builtins/sum.
See Also
No see-alsos for builtins/sum
0 Notes
No notes for sum