Write a Python program to multiply all the items in a list


This program is using a for loop to iterate through a list of numbers called "item". For each number in the list, the program multiplies it by the current value of the "total" variable. The initial value of total is set to 1, so the first time through the loop, the value of the first item in the list is assigned to "total" and the loop continues. The next time through the loop, the value of the second item in the list is multiplied by the current value of "total", and so on. Once the loop has finished iterating through all the items in the list, the final value of "total" is printed, which is the product of all the numbers in the list.

Source Code

item=[3,4,5,4,7]
total = 1
for i in item:
	total *= i
print(total)
 
 

Output

1680

Example Programs