Sum a list of numbers in Python

Here is a code snippet that demonstrates how to sum a list of numbers in Python:

numbers = [1, 2, 3, 4, 5]
total = sum(numbers)
print(total)

Watch a course Python - The Practical Guide

You can also use a for loop to sum the list of numbers:

numbers = [1, 2, 3, 4, 5]
total = 0

for num in numbers:
    total += num

print(total)

Both the above code snippet will give you the sum of the list of numbers.