0
Cant get the loop to break
while True: operation=input("choose an operation from +,-,/,*: ") print(operation) num1=float(input("enter a value: ")) print(num1) num2= float(input("enter another value: ")) print(num2) if operation=="stop": print("stopping") break elif operation=="+": result=(num1+num2) print(result) elif operation=="-": print(num1-num2) elif operation=="/": print(num1/num2) elif operation=="*": print(num1*num2)
4 odpowiedzi
0
you can use the “break” keyword somewhere in that code when needed to break the loop
0
Ive done that if you ve seen my code pikachu.....
0
i see but operation may never equal “stop”
if that happens, the code will never break.
0
I have given the program a 'stop' input , i dont understand why its not breaking as operation is equal to stop