+ 1

Como sumar todo lo que hay en una lista?

27th Aug 2016, 10:45 AM
Paula Font
Paula Font - avatar
4 Respostas
+ 2
sum=0 for n in nums: sum += n print(sum)
28th Aug 2016, 9:03 AM
Xavi
Xavi - avatar
0
Ya lo sabes
27th Aug 2016, 10:46 AM
Arnau Solà Corbella
Arnau Solà Corbella - avatar
0
como?
27th Aug 2016, 10:48 AM
Paula Font
Paula Font - avatar
0
n=eval(input()) y=0 x=0 nums=[] while x<=n: nums.append(x) y=x+y x=x+2 print(nums) print(y)
27th Aug 2016, 10:49 AM
Arnau Solà Corbella
Arnau Solà Corbella - avatar