Método Python math.prod()
Ejemplo
Devuelve el producto de los elementos del iterable dado:
# Import math Library
import math
sequence = (2, 2, 2)
#Return the product of the elements
print(math.prod(sequence))
Definición y uso
El math.prod()
método devuelve el producto de los elementos del iterable dado.
Sintaxis
math.prod(iterable, start)
Valores paramétricos
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 |
Detalles técnicos
Valor devuelto: | El producto de los elementos del iterable. |
---|---|
Versión de Python: | 3.8 |