Answers for "sum function on list of string ?"

18

python sum of list

>>> list = [1, 2, 3]
>>> sum(list)
6
Posted by: Guest on January-27-2020
0

sum of elements in a list.

data = ['5', '4', '9']

sum(int(i) for i in data)
18
Posted by: Guest on November-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language