0
What are the mistakes in this code ?
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)
11 Answers
+ 12
Mahaveer Singh Ranawat
Remove opening parenthesis from first and second line.
+ 2
Mahaveer Singh Ranawat
Working fine for me
+ 1
It is showing again also
0
Works well if you remove parenthesis in line one and two
0
Can anyone suggest me a good java YouTube channal
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)
1.remove opening ( from first two lines .
2.Remove space between ' ' and semicolon for a clean code in elif statements.
0
Idk
0
You have 3((( on the left and 2)) on the right.
- 1
I didn't use else anywhere
- 1
It is showing syntax error in line 2
- 1
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)