Summing Values the Pythonic Way With sum() (Summary)
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
You’ll probably also enjoy these video courses:
- Exploring the Python math Module
- Splitting, Concatenating, and Joining Strings in Python
- Building Lists With Python’s .append()
- When to Use a List Comprehension in Python
- Defining and Calling Python Functions
With this knowledge, you’re now able to add multiple numeric values together in a Pythonic, readable, and efficient way.
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
00:00
Summary. Well done, you’ve made it to the end of the course. You can now use Python’s built-in function sum()
to add multiple numeric values together.
00:10
This function provides an efficient, readable, and Pythonic way to solve summation problems in your code. If you are dealing with math computations that require summing numeric values, then sum()
can be your lifesaver. In this 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
and start
arguments in sum()
, and decide between sum()
and alternative tools to sum and concatenate objects. With this knowledge, you are now able to add multiple numeric values together in a Pythonic, readable, and efficient way. We hope you found this course useful, and we’ll see you again soon at realpython.com.
Become a Member to join the conversation.