Write a Python program to compute the product of a list of integers (without using a for loop).

Write a Python program to compute the product of a list of integers (without using a for loop).

1
2
3
4
5
6
from functools import reduce
nums = [10, 20, 30,]
print("Original list numbers:")
print(nums)
nums_product = reduce( (lambda x, y: x * y), nums)
print("\nProduct of the said numbers (without using for loop):",nums_product)

Final output

Leave a Comment