Program:
#creating listn=int(input("Enter the Number of Element in the List:"))
lst=[]
for i in range(0,n):
no=int(input(">"))
lst.append(no)
print("List=",lst)
#for sum of the all element in the list
sum_list=sum(lst)
print("Sum of the all Numbers in the List is ",sum_list,".")
Expexted O/P:
Enter the Number of Element in the List:4
>54
>32
>12
>10
List= [54, 32, 12, 10]
Sum of the all Numbers in the List is 108 .

0 Comments
Post a Comment