top of page

Write a program to Find the Sum of the list in Python

Updated: Dec 16, 2021

See the flowchart below to understand how the code will work.




Code:

ListSum = []    #crate a empty list in Python
                #takes input for number of elements in list
num = int(input("How many numbers you want to Add: "));
for n in range(num):
    numbers=int(input("Enter numbers: "));
    ListSum.append(numbers)
print("Sum of numbers in list: ",sum(ListSum))

output:







You can also add Negative number in the list. See the out below :








Read More:




The Tech Platform

0 comments
bottom of page