0
Why am I getting no output?
sum = 0 x = int(input()) while True: sum+=x if x == "stop": break print(x)
6 ответов
+ 1
x is an integer, it will never equal "stop". Therefore the loop will run infinitely and nothing is printed
+ 1
I think you want to take multiple inputs, right?
* put x = input() inside the loop
* first check if x == stop (if so, break)
* if not, you can do x = int(x) and add to sum
0
Thank you very much.
0
Sorry but now I have another problem. If I don't change the input to an integer, I can't add the numbers? Can I?
I get an error for line 4.
0
Thanks very much, I'll give it another go.