Examples:
Input: list1 = [1, 2, 3] Output: 6 Explanation: 1 * 2 * 3 = 6 Input: list1 = [3, 2, 4] Output: 24Method 1: workaround
Initialize the product value to 1 (not 0, if 0 multiplied by anything returns zero). Go to the end of the list, multiply each number by the product. The value stored in the product at the end will give you your final answer.
Below this Python implementation of the above approach:
result = result * x 
Output:
6 24
Method 2: Using numpy.prod ()
We can use numpy.prod () from import numpy to get the multiplication of all numbers in the list. Returns an integer or floating point value depending on the result of the multiplication.
Below is Python3 implementation of the above approach:

Output:
6 24
Method 3 of 3: Using a lambda function: Using numpy.array
Lambda definition not contains a return statement, it always contains the expression that is returned. We can also put a lambda definition wherever a function is expected and we don`t need to assign it to a variable at all. This is the simplicity of lambda functions. The Reduce () function in Python takes a function and a list as an argument. The function is called with a lambda function and a list, and returns the result minified by ew . This performs an iterative operation on pairs of the list.
Below is the implementation of the above approach in Python3:

Exit:
6 24
We are witnessing a movement that will completely transform any part of business and society. The word we have given to this move ment is Big Data and it will change everything, from the way banks an...
10/07/2020
In Learn Python 3 the Hard Way PDF, you'll learn Python by working through 52 brilliantly crafted exercises. Read them. Enter your code exactly. (No copying and pasting!) Correct your mistakes. ...
05/09/2021
Pandas 1.x Cookbook: Practical recipes for scientific computing, time series analysis, and exploratory data analysis using Python, 2nd Edition....
05/09/2021
Introduction to Machine Learning with Python: A Guide for Data Scientists 1st Edition. Machine learning has become an integral part of many commercial applications and research projects, but this f...
05/09/2021