This is the question I m having problem in "write a function sumprimes(l) that takes as input a list of integers and returns the sum of all the prime numbers in l".
here r some examples to show how your function should work >>>sumprimes([3,3,1,13]) 19 >>>sumprimes([-3,1,6]) 0 here is my solution def sumprimes(l): sum=0 for i in range (0,len(l)): num=l[i] if num >1: prime= True for j in range(2,int(num**0.5)+1): if(num%j==0): prime=False break if prime: sum=sum+num else : sum=0 return sum the problem with me is that sumprimes([17,51,29,39]) is giving output 0 instead of 46 & sumprimes([3,3,1,13]) is giving correct output which is 19 and gives correct output also for ([2,4,6,9,11]) nd ([-3,1,6]) plz tell me where my mistake is nd what might correct it