Python: Compute the product of a list of integers
Python Basic: Exercise-115 with Solution
Write a Python program to compute the product of a list of integers (without using for loop).
from functools import reduce nums = [10, 20, 30,] nums_product = reduce( (lambda x, y: x * y), nums) print("Product of the numbers : ",nums_product)
Product of the numbers : 6000
Visualize Python code execution:
The following tool visualize what the computer is doing step-by-step as it executes the said program:
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
New Exercises:R Programming