Question #118694

Write a program that reads in a series of numbers and adds them up until the user enters zero (this stopping value is often called a rogue value).

Expert's answer

ROGUE_VALUE = 0
sum = 0
while True:
    number = float(input("Enter number:"))
    if number == ROGUE_VALUE:
        break
    sum += number


print("sum is {}".format(sum))

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!

LATEST TUTORIALS
APPROVED BY CLIENTS