Categories
Python Answers

How to sum a list of numbers in Python?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *