I have tried to add sum of even numbers of a list and I am successful but in my second part I am not able to delete even numbers from the list. For example my input is [1,2,4,6,5] and When I tried this given code below, the output for sum of even numbers was 8 and new list was [1,4,5]. I want output as sum of even numbers as 12 and new list is [1,5].
n=list(map(int, input("elements of array:-").strip().split()))
even_sum = 0
for num in n:
if num%2==0:
even_sum += num
n.remove(num)
else:
odd_sum += num
print(even_sum)
print(n)