Python math.prod() Metode
Contoh
Kembalikan produk elemen dari iterable yang diberikan:
# Import math Library
import math
sequence = (2, 2, 2)
#Return the product of the elements
print(math.prod(sequence))
Definisi dan Penggunaan
Metode math.prod()
mengembalikan produk elemen dari iterable yang diberikan.
Sintaksis
math.prod(iterable, start)
Nilai Parameter
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 |
Detail Teknis
Nilai Kembali: | Produk dari elemen dari iterable |
---|---|
Versi Python: | 3.8 |