0

What's wrong with this code?🤔

while True: print("########################################") print(" PYTHON CALCULATOR") print("#############$ wizard $#############") print() print() print("Options:") print(" ¢ Addition Two Numbers.Please Enter '+' ") print(" ¢ Subtract Two Numbers.Please Enter '-' ") print(" ¢ Multiply Two Numbers.Please Enter '*' ") print(" ¢ Divide Two Numbers.Please Enter '/' ") print(" ¢ Exit.Please Enter 'E' ") x=input("Enter Your Choice:") print() print() num1=float(input("Input Your Number 1")) num2=float(input("Input Your Number 2")) if x=="E": print("Thanks For Using This Service😎") print() print() break elif x=="+": print( num1+num2) print() print() elif x=="-": print(num1-num2) print() print() elif x=="*": print(num1*num2) print() print() elif x=="/": print(num1/num2) print()

8th Jul 2020, 8:03 AM
W.D.M.M.S.Karunarathna
W.D.M.M.S.Karunarathna - avatar
8 Answers
+ 2
Say in your program above, it asks for an operator, then two seperate numbers. Anywhere else you'll just enter the numbers when prompted. BUT, SoloLearn takes input differently. All the input needs to be put in at the same time and then it will run. Try entering this: + 5 10 After all that mumbo jumbo, you get 15.0. You will get an error here after that but its only because of the while loop. You'd need to change that loop or enter more math problems to keep it going
8th Jul 2020, 8:19 AM
Slick
Slick - avatar
+ 4
What's the error you are getting?
8th Jul 2020, 8:07 AM
Arnesh
Arnesh - avatar
+ 1
Tried it and it works fine. Are you aware of how to insert multiple inputs in SL playground? Its all gotta be at once, with each input on a seperate line, then you submit.
8th Jul 2020, 8:12 AM
Slick
Slick - avatar
+ 1
In sololearn, you need to split input into 2 lines: Input1 Input2
8th Jul 2020, 8:19 AM
Arnesh
Arnesh - avatar
+ 1
Oh! Thanks Slick & Arnesh 😊
8th Jul 2020, 8:24 AM
W.D.M.M.S.Karunarathna
W.D.M.M.S.Karunarathna - avatar
0
I am a beginner, do not work this😐
8th Jul 2020, 8:13 AM
W.D.M.M.S.Karunarathna
W.D.M.M.S.Karunarathna - avatar
0
I can not input the two numbers.why?
8th Jul 2020, 8:18 AM
W.D.M.M.S.Karunarathna
W.D.M.M.S.Karunarathna - avatar