+ 1

Help with Calculator

Can any one assist I keep gettin and error when I try to run the task num1 = float(input("enter first number: ")) op = input("enter operator: ") num2 = float(input("enter second number: ")) if op == "+": print(num1 + num2) elif op == "-": print(num1 - num2) elif op == "/": print(num1 / num2) elif op == "*": print(num1 * num2) else: print("invalid operator")

20th Mar 2019, 6:32 PM
Jesse James
Jesse James - avatar
7 Answers
+ 6
hi jesse, your code is running perfectly. I belive the problem is to do the input correctly in Code Playground. You have to do it like this: (when input window comes up) Place each input in a separate line then klick submit. 2 + 3 (press submit) this will show 5
20th Mar 2019, 6:41 PM
Lothar
Lothar - avatar
+ 2
Jesse, do you have the code in the playground? If yes - just include the link for me. I have to see what error occures.
20th Mar 2019, 7:32 PM
Lothar
Lothar - avatar
+ 2
jesse, here is your code in playground: try it. https://code.sololearn.com/cTsOZYyrtjnb/?ref=app
20th Mar 2019, 7:50 PM
Lothar
Lothar - avatar
+ 1
thanks i really appreciate it
20th Mar 2019, 8:30 PM
Jesse James
Jesse James - avatar
0
I gave it a shot but im still getting the same error
20th Mar 2019, 6:48 PM
Jesse James
Jesse James - avatar
0
File "..\Playground\", line 1 num1 = float(input("enter first number: ^ SyntaxError: EOL while scanning string literal
20th Mar 2019, 7:34 PM
Jesse James
Jesse James - avatar