0
Why is this not working?
a = float(input("enter a number:")) b = float(input("enter another number:")) while true: print("program:") print("enter '+' to +") print("enter '-' to -") print("enter '/' to /") print("enter '*' to *") print("enter 'Q' to end") x = input() if x == "Q": break elif x == "+": print(a, "+" ,b, "=" ,a + b) elif x == "-": print(a, "-" ,b, "=" ,a - b) elif x == "/": print(a, "/" ,b, "=" ,a / b) elif x == "*": print(a, "*" ,b, "=" ,a * b) else: print("ERROR")
8 Respuestas
+ 7
Any error message popping up?
+ 6
Change ~
while true:
To ~
while True:
+ 5
If you're getting the EOF error :
Try on PC/QPython android app
[OR]
Predict what you'll have to input and write it accordingly in different lines, as the SL Code Playground cannot ask for input in real time it only asks once (at the start)
+ 1
Okay.. thanks.. I am going to try it on PC
0
Still not working
0
?? what are you expecting to happen?
Although it does not ask for the two floats again and does do the arithmetic using the chosen operator on the same two float initially entered. if that what you're looking to do, then if works (just change true to True)
0
I already changed it.. Still not working🤷♂️