0
operator = input("enter operator (+,-,*,/) : "). Syntax error occurring in this , how to fix it ?
4 Réponses
+ 4
A syntax error occurs when we're missing punctuation, closing brackets.
Btw, can we see your code?
+ 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
0
Code to the studio please
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)