You can now use Python’s built-in function sum()
to add multiple numeric values together. This function provides an efficient, readable, and Pythonic way to solve summation problems in your code. If you’re dealing with math computations that require summing numeric values, then sum()
can be your lifesaver.
In this video course, you learned how to:
- Sum numeric values using general techniques and tools
- Add several numeric values efficiently using Python’s
sum()
- Concatenate sequences using
sum()
- Use
sum()
to approach common summation problems - Use appropriate values for the
iterable
andstart
arguments insum()
- Decide between
sum()
and alternative tools to sum and concatenate objects
To learn more about the concepts in this video course, check out these tutorials:
- The Python math Module: Everything You Need to Know
- Splitting, Concatenating, and Joining Strings in Python
- Iterators and Iterables in Python: Run Efficient Iterations
- Itertools in Python 3, By Example
- Python’s .append(): Add Items to Your Lists in Place
- When to Use a List Comprehension in Python
- Defining Your Own Python Function