- 1

Can you add all the integers in a list?

Let's say I have a list that has [ 1, 2, 3, 4]. I want to add all the integers to get the value 10. How do you that in Python

8th May 2020, 6:44 PM
Rzza bakir
Rzza bakir - avatar
3 Answers
+ 1
a=0 For i in list: a+=i
8th May 2020, 6:46 PM
Abhay
Abhay - avatar
+ 1
Thanks kiibo it helped
8th May 2020, 6:56 PM
Rzza bakir
Rzza bakir - avatar