Python Program to find sum of List Items Using For Loop

Python Program to find sum of List Items Using For Loop

 

my_list=[10,20,30,40,50]

sum=0

print("List items are:")

for i in my_list:

    print(i)

    sum=sum+i

print("The sum of list items is:",sum)


Output:

List items are:

10

20

30

40

50

The sum of list items is: 150



टिप्पणी पोस्ट करा

0 टिप्पण्या