Sometimes, we want to sum a list of numbers in Python.
In this article, we’ll look at how to sum a list of numbers in Python.
How to sum a list of numbers in Python?
To sum a list of numbers in Python, we can use the sum
function.
For instance, we write
s = sum(list_of_nums)
to call sum
with the 1ist_of_nums
numbers list to sum up all the numbers in the list and return the result.
Conclusion
To sum a list of numbers in Python, we can use the sum
function.