0
Sum item in list
How do I sum up items of a list using a For loop E.g my_num = [1, 2, 3, 5, 2, 5]
2 ответов
+ 5
my_list = [1, 3, 4, 7]
sum=0
for x in my_list:
sum+=x
print(sum)
OR
my_list = [1, 3, 4, 7]
print(sum(my_list))
How do I sum up items of a list using a For loop E.g my_num = [1, 2, 3, 5, 2, 5]