Python math.prod() Metodo
Esempio
Restituisce il prodotto degli elementi dall'iterabile dato:
# Import math Library
import math
sequence = (2, 2, 2)
#Return the product of the elements
print(math.prod(sequence))
Definizione e utilizzo
Il math.prod()
metodo restituisce il prodotto degli elementi dall'iterabile specificato.
Sintassi
math.prod(iterable, start)
Valori dei parametri
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 |
Dettagli tecnici
Valore di ritorno: | Il prodotto degli elementi dell'iterabile |
---|---|
Versione Python: | 3.8 |