Python Math.prod() Metoda
Przykład
Zwróć iloczyn elementów z podanej iteracji:
# Import math Library
import math
sequence = (2, 2, 2)
#Return the product of the elements
print(math.prod(sequence))
Definicja i użycie
Metoda math.prod()
zwraca iloczyn elementów z podanej iteracji.
Składnia
math.prod(iterable, start)
Wartości parametrów
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 |
Szczegóły techniczne
Wartość zwrotu: | Iloczyn elementów z iterowalnego |
---|---|
Wersja Pythona: | 3,8 |