Python - Compute the product of all the items in a list

Description

Compute the product of all the items in a list

Demo

prod = 1 
for item in [1, 2, 3, 4]: prod *= item 

print(prod )#   w  ww. j a v a2 s.co  m

Result

Related Example