← Winnitude! Search  ·  Reader Mode (1096 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
REAL PYTHON · Real Python · 29 LINKS

Summing Values the Pythonic Way With sum() - Real Python

Go to the next lesson

Summing Values the Pythonic Way With sum()

Darren Jones 8 Lessons 29m basics python

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 video course, 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 sum() and alternative tools to sum and concatenate objects

This knowledge will help you efficiently approach and solve summation problems in your code using either sum() or other alternative and specialized tools.

What's Included:

Downloadable Resources:

Start Now

Summing Values the Pythonic Way With sum()

8 Lessons 29m

  1. 1. Summing Values the Pythonic Way With sum() (Overview) 01:29
  2. 2. Understanding the Summation Problem 04:36
  3. 3. Getting Started With Python's sum() 04:37
  4. 4. Summing Numeric Values and Concatenating Sequences 03:03
  5. 5. Practicing With Python's sum() 06:35
  6. 6. Flattening a List of Lists 03:07
  7. 7. Using Alternatives to sum() 04:34
  8. 8. Summing Values the Pythonic Way With sum() (Summary) 01:02
Start Now

About Darren Jones

With 20 years as a teacher of music technology, Darren is keen to bring his skills to the Python table.

» More about Darren

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Christopher

Kate

Tappan

Leodanis

Joanna

Aldren

Bartosz

Jacob

Sadie

← Browse All Courses