Methode Python math.prod()
Voorbeeld
Retourneer het product van de elementen uit de gegeven iterable:
# Import math Library
import math
sequence = (2, 2, 2)
#Return the product of the elements
print(math.prod(sequence))
Definitie en gebruik
De math.prod()
methode retourneert het product van de elementen uit de gegeven iterabele.
Syntaxis
math.prod(iterable, start)
Parameterwaarden
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 |
Technische details
Winstwaarde: | Het product van de elementen uit de iterabele |
---|---|
Python-versie: | 3.8 |