Write a Python program to sum all the items


The program is a simple Python script that finds the sum of all elements in a given list of integers. It uses a for loop to iterate through each element in the list, and for each element, it adds it to a variable 'sum'. Finally, it prints the value of the variable 'sum' which is the total sum of all elements in the list. The list is hardcoded with some values, but can be changed accordingly to the user's needs.

Source Code

item=[1,7,-10,34,2,-8]
sum = 0
for i in item:
	sum+= i
print(sum)

Output

26

Example Programs