+ 2
en python como sumo los numeros de una lista?
6 Réponses
+ 5
Puedes utilizar la función "sum" y pasarle la lista como argumento.
Ejemplo:
result = sum(your_list)
+ 4
s = 0
l = [19, 25, 7, 48, 33]
# Iterate each element in list
# and add them in variale total
for i in range(len(l)):
s = s + l[i]
# printing total value
print("Sum of all elements in given list: ", s)
https://www.sololearn.com/discuss/2142611/?ref=app
https://www.sololearn.com/discuss/2271588/?ref=app
https://www.sololearn.com/discuss/2268308/?ref=app
https://www.sololearn.com/discuss/2215834/?ref=app
https://www.sololearn.com/discuss/754293/?ref=app
https://code.sololearn.com/c75GJYY27UNh/?ref=app
https://code.sololearn.com/cBbC1bh0bdWf/?ref=app
https://code.sololearn.com/cpw0wwdA95Wl/?ref=app
+ 1
Abhay jaja but google wasnot going to give me an exact answer. gracias Luciano Curti sos un kpo
+ 1
De nada nacho agost !
+ 1
Hay varias formas, puedes crear una función ,un lado de repetición y otras formas
- 1
There is something called Google that I am sure you can access anytime for free!! Atleast do your own research and then ask something that you don't really understand