0
Help Do the math python practice result 1, 3 6, 10, 15
Multiple results are given in test case, the result should be 15 sum = 0 while True: x = input() if x == "stop": break else: sum += int(x) print(sum)
2 Answers
+ 3
Your print() is called on each iteration because it's indented such that it's part of while loop's body.
Remove indentation (white space before print). Then it'll get called only once, when while loop is terminated.
+ 1
Thank you Omkar!