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 )# ww  w  .  j av  a 2  s. c  o m

Result

Related Example