add all values in list python code example
Example 1: python sum of list
>>> list = [1, 2, 3]
>>> sum(list)
6
Example 2: python add all values of another list
a = [1, 2, 3]
b = [4, 5, 6]
a += b
# another way: a.extend(b)
>>> list = [1, 2, 3]
>>> sum(list)
6
a = [1, 2, 3]
b = [4, 5, 6]
a += b
# another way: a.extend(b)