+ 2
How can I get the sum of items in an itarator. That is after removing all even numbers in a list and itarating it.Someone help👋
p=[2,5,6,4 ,3,7] for i in p: if i%2==0: i.remove(i%2==o) print(sum(i)) print(sum(p))
3 Respostas
+ 3
p = [2,5,6,4,3,7]
print(sum(x for x in p if x%2))
0
Visph thanks so much I appreciate
0
List comprehension is best for solving such🤗🤗