0

How can I get the sum of items in a list after removing even numbers by an iteration.Someone to help👋 Here is my code

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))

23rd Feb 2021, 4:47 AM
Emmanuel Kipngeno cheruiyot
Emmanuel Kipngeno cheruiyot - avatar
2 ответов
+ 1
p = [2,5,6,4,3,7] print(sum(x for x in p if x%2))
23rd Feb 2021, 5:37 AM
visph
visph - avatar
0
I am not seeing the other questions
23rd Feb 2021, 1:18 PM
Emmanuel Kipngeno cheruiyot
Emmanuel Kipngeno cheruiyot - avatar