Python Project

Program to print the sum of given list elements.

Class 11th CBSE IP

Assignment

Q.3 Program to print the sum of given list elements.

Solution :-

 

l =[]
sum = 0
#Number of elements will be entered by the user
n = int(input(“Enter the number of elements in the list:”))
# for loop to take the input
for i in range(0,n):
# The input is taken from the user and added to the list as the item
         l.append(int (input(“Enter the item:”)))
         sum = sum + l[i]
print(“printing the sum of the list items..”,sum)

# traversal loop to print the list items

Output :- 

Try this code 

Fun & Easy to follow
Works on all devices
Your own Pace
Super Affordable

Popular Videos

Play Video

UX for Teams

Learn the basics and a bit beyond to improve your backend dev skills.

ava4.png
Chris Matthews

Designer

Play Video

SEO & Instagram

Learn the basics and a bit beyond to improve your backend dev skills.

ava4.png
Chris Matthews

Designer