Skip to content

Python code snippet – How to add up everything in a list ?

num = [1,2,3,4]

print(num.sum())
#We use the .sum() function for the adding of everything
See also  How to remove an item from a certain index in Python?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.