Posts by Carla • 1 point
1 post
-
-4
votes4
answers1133
viewsA: Add negative elements from a list
l=[12, -2, 4, 8, 29, 45, 78, 36, -17, 2, 12, 8, 3, 3, -52] soma=0 for n in l: n=int(n) if n<0: soma=soma+n print(soma)
1 post
-4
votes4
answers1133
viewsl=[12, -2, 4, 8, 29, 45, 78, 36, -17, 2, 12, 8, 3, 3, -52] soma=0 for n in l: n=int(n) if n<0: soma=soma+n print(soma)