Write a Python program that reads numbers from the user. Your program should stop reading in numbers when the number 99 is entered. It should then print out the sum of the numbers entered – do not include the value 99 when calculating your sum
i = 0
list1 = []
while i==0:
n = eval(input('Enter number here:'))
list1.append(n)
if n == 99:
break
print(sum(list1[:-1]))
Enter number here:56
Enter number here:6
Enter number here:76
Enter number here:89
Enter number here:54
Enter number here:99
281
Comments
Leave a comment