Python math.prod()- Methode
Beispiel
Gibt das Produkt der Elemente aus der angegebenen Iterable zurück:
# Import math Library
import math
sequence = (2, 2, 2)
#Return the product of the elements
print(math.prod(sequence))
Definition und Verwendung
Die math.prod()
Methode gibt das Produkt der Elemente aus der angegebenen Iterable zurück.
Syntax
math.prod(iterable, start)
Parameterwerte
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
Rückgabewert: | Das Produkt der Elemente aus dem Iterable |
---|---|
Python-Version: | 3.8 |