Python Program to Compute Cumulative Product of a List of Numbers

Aim:

Write a function cumulative_product to compute the cumulative product of a list of numbers.

Program:

def product(list):
p =1
for i in list:
p *= i
print(p)
return p
arr= [1,2,3,4,5,6,7,8,9,10]
c=product(arr) 

Execution:

1
2
6
24
120
720
5040
40320
362880
3628800 

Leave a Comment