sum is a very practical function in python, but you must pay attention to its use. The first time I used it, I used it like this:
s = sum(1,2,3)
The result was tragic La
In fact, the parameter of sum() is a list
For example:
sum([1,2,3])
sum(range(1,11))
There is also a more interesting usage
a = range(1,11)
b = range(1,10)
c = sum([item for item in a if item in b])
print c
Output:
45