Example-
list is l=[2,3,6,7,8,9,11,12,13]
then sum of prime number in list is 2+3+7+11+13=36
program-
#import the functools module
import functools
l=[2,3,4,5,6,7,9,10,11,11,13,17,15]
print("List is ",l)
def findprime(n):
for i in range(2,int(n/2)+1):
if n%i==0:
return False
return True
#first way
sum=0
for i in l:
if findprime(i):
sum+=i
print("Sum of prime number is :",sum)
#second way
l=filter(findprime,l )
sum=functools.reduce(lambda x,y:x+y,l)
print("Sum of prime number is :",sum)
List is [2, 3, 4, 5, 6, 7, 9, 10, 11, 11, 13, 17, 15]
Sum of prime number is : 69
Sum of prime number is : 69