Método Python math.prod()
Exemplo
Retorne o produto dos elementos do iterável fornecido:
# Import math Library
import math
sequence = (2, 2, 2)
#Return the product of the elements
print(math.prod(sequence))
Definição e uso
O math.prod()
método retorna o produto dos elementos do iterável fornecido.
Sintaxe
math.prod(iterable, start)
Valores de parâmetro
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 |
Detalhes técnicos
Valor de retorno: | O produto dos elementos do iterável |
---|---|
Versão do Python: | 3.8 |