Compute the product of all the items in a list
prod = 1 for item in [1, 2, 3, 4]: prod *= item print(prod )# w ww. j a v a2 s.co m