Python’s sum(): The Pythonic Way to Sum Values
![](https://www.deeplearningdaily.com/wp-content/uploads/2021/10/pythons-sum-the-pythonic-way-to-sum-values_615de22d8fb1f-375x210.jpeg)
Python’s built-in function sum()
is an efficient and Pythonic way to sum a list of numeric values. Adding several numbers together is a common intermediate step in many computations, so sum()
is a pretty handy tool for a Python programmer.
As an additional and interesting use case, you can concatenate lists and tuples using sum()
, which can be convenient when you need to flatten a list of lists.
In this tutorial, you’ll learn how to:
- Sum numeric values by hand using general techniques and tools
- Use Python’s
sum()
to add several numeric values efficiently - Concatenate lists and tuples with
sum()
- Use
sum()
to approach common summation problems - Use appropriate values for the arguments in
sum()
- Decide between