Answer to Question #221841 in Python for Mikey Meegan

Question #221841

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


1
Expert's answer
2021-07-31T07:20:38-0400
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS