Product of all odd integers
Problem to product the all odd integers in the list.
Example-1:
Input : n = [ 1, 5, 2, 4, 7] Output : 35 Explain : The odd numbers are 1,5,7. So the product is 1*5*7=35.
Example-2:
Input : n = [ 1, 2, 3, 4, 5] Output : 15 Explain : The odd numbers are 1,3,5. So the product is 1*3*5=15.
Solution
n = [ 1, 5, 2, 4, 7] k = 1 for x in n: if(x % 2 != 0): k *= x print(k)
Output
35