Example-
list is l=[1,2,1,2,1,2]
then sum of odd number from the list is 1+1+1=3
program-
#import the functools module
import functools
l=[1,2,3,4,5,6]
print("List is ",l)
#first way
sum=0
for i in l:
if i%2==1:
sum+=i
print("Sum of odd term is :",sum)
#second way
l=filter(lambda x: x%2==1,l )
sum=functools.reduce(lambda x,y:x+y,l)
print("Sum of odd term is :",sum)
List is [1, 2, 3, 4, 5, 6]
Sum of odd term is : 9
Sum of odd term is : 9