I'm struck and need assistance with this. I need to discover the sum of prime numbers from a given list of whole numbers (Integers). Here are a couple of experiments for the equivalent.

n([3,3,1,13])

19

n([2,4,6,9,11])

13

n([-3,0,1,6])

0

Just look at the below code, but it fails in the test cases above.

def sumprimes(n):

sum1 = 0

for i in range(0,len(n)):

num = n[i]

if num > 1:

for j in range(2, int(num**0.5)+1):

if num%j != 0:

sum1 = sum1 + num

else:

sum1 = 0

return(sum1)