Question #2980

Design a program in python with a loop that asks the user enter a series of positive numbers and display their sum.

Expert's answer

#!/usr/bin/python

n = input("Please enter the number of letters: ")

s = 0

for i in range(1,n+1):

print 'a[',i,']='

a=input()

s=s+a

print 'The total sum of all these numbers is ',s

#####################################################

n = input("Please enter the number of letters: ")

s = 0

for i in range(1,n+1):

print 'a[',i,']='

a=input()

s=s+a

print 'The total sum of all these numbers is ',s

#####################################################

## Comments

## Leave a comment