Python math.prod() Method

❮ Math Methods


Example

Return the product of the elements from the given iterable:

# Import math Library
import math

sequence = (2, 2, 2)

#Return the product of the elements
print(math.prod(sequence))
Try it Yourself »

Definition and Usage

The math.prod() method returns the product of the elements from the given iterable.


Syntax

math.prod(iterable, start)

Parameter Values

Parameter Description
iterable Required. Specifies the elements of the iterable whose product is computed by the function
start Optional. Specifies the starting value of the product. Default value is 1

Technical Details

Return Value: The product of the elements from the iterable
Python Version: 3.8

❮ Math Methods

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.