Why is this not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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")

24th Aug 2019, 2:36 PM
David Manzat
David Manzat - avatar
8 Answers
+ 7
Any error message popping up?
25th Aug 2019, 5:12 AM
Nikhil
Nikhil - avatar
+ 6
Change ~ while true: To ~ while True:
24th Aug 2019, 2:46 PM
Nikhil
Nikhil - avatar
+ 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)
24th Aug 2019, 2:54 PM
Nikhil
Nikhil - avatar
+ 1
Okay.. thanks.. I am going to try it on PC
24th Aug 2019, 2:56 PM
David Manzat
David Manzat - avatar
0
Still not working
24th Aug 2019, 2:51 PM
David Manzat
David Manzat - avatar
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)
24th Aug 2019, 11:46 PM
rodwynnejones
rodwynnejones - avatar
0
I already changed it.. Still not working🤷‍♂️
25th Aug 2019, 3:20 AM
David Manzat
David Manzat - avatar
1st Oct 2019, 3:24 AM
Jacob Rooney
Jacob Rooney - avatar