additionner liste python

Solutions on MaxInterview for additionner liste python by the best coders in the world

showing results for - "additionner liste python"
Quentin
31 Nov 2016
1>>> list = [1,2,3,4]
2>>> sum(list)
310
4
5>>> l = ['a',1,'f',3.2,4]
6>>> sum([i for i in l if isinstance(i, int) or isinstance(i, float)])
78.2
Alex
26 Nov 2016
1>>> list = [1,2,3,4]
2>>> tot = 0
3>>> for i in list:
4...     tot = tot + i
5... 
6>>> tot
710