Python math.prod()วิธี การ
ตัวอย่าง
ส่งคืนผลิตภัณฑ์ขององค์ประกอบจาก iterable ที่กำหนด:
# Import math Library
import math
sequence = (2, 2, 2)
#Return the product of the elements
print(math.prod(sequence))
ความหมายและการใช้งาน
เมธอดส่ง คืนmath.prod()
ผลิตภัณฑ์ขององค์ประกอบจาก iterable ที่กำหนด
ไวยากรณ์
math.prod(iterable, start)
ค่าพารามิเตอร์
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 |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ผลคูณขององค์ประกอบจากiterable |
---|---|
เวอร์ชันหลาม: | 3.8 |