0

operator = input("enter operator (+,-,*,/) : "). Syntax error occurring in this , how to fix it ?

4th Jan 2022, 4:34 PM
Mahaveer Singh Ranawat
4 Answers
+ 4
A syntax error occurs when we're missing punctuation, closing brackets. Btw, can we see your code?
4th Jan 2022, 5:25 PM
Simba
Simba - avatar
+ 1
first = int(input("enter first number:") operator = input("enter operator (+,-,*,/) : ") second = int(input("enter second number :") ) if operator == '+': print(first + second) elif operator == '-' : print (first - second) elif operator == '*' : print (first * second) elif operator == '/' : print (first / second) But you have to prevent zero division error
5th Jan 2022, 4:19 AM
Shadoff
Shadoff - avatar
0
Code to the studio please
4th Jan 2022, 5:27 PM
Shadoff
Shadoff - avatar
0
first = (input("enter first number:") operator = (input("enter operator (+,-,*,/) : ") second = input("enter second number :") first = int(first ) second = int(second) if operator == '+': print(first + second) elif operator == '-' : print (first - second) elif operator == '*' : print (first * second) elif operator == '/' : print (first / second)
5th Jan 2022, 1:30 AM
Mahaveer Singh Ranawat