python sum list values code example
Example 1: python sum attribute in list
sum(c.a for c in c_list)
Example 2: python sum of list
>>> list = [1, 2, 3]
>>> sum(list)
6
Example 3: how to find the sum of a list in python
print(a+b):
sum(c.a for c in c_list)
>>> list = [1, 2, 3]
>>> sum(list)
6
print(a+b):