0
Can someone help? I've been stuck on this problem for a few days now.
You’re making a calculator that should add multiple numbers taken from input and output the result. The number of inputs is variable and should stop when the user enters "stop". Sample Input 4 32 6 stop Sample Output 42 Use an infinite loop to take user input and break it if the input equals "stop". https://code.sololearn.com/cc4W85i4NoGY/?ref=app
4 Réponses
+ 4
You print the result in every iteration of the loop. You should only print the final result. Just unindet your print statement.
+ 3
use this:
x =input()
c=0
while x!='stop':
x=int(x)
c+=x
x=input()
print(c)
0
Move print(sum) into tje if statement when x=="stop" before break.
0
Thank you, I can't believe thats all it was.