What are the mistakes in this code ? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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)

5th Jan 2022, 1:32 AM
Mahaveer Singh Ranawat
11 Respuestas
+ 12
Mahaveer Singh Ranawat Remove opening parenthesis from first and second line.
5th Jan 2022, 2:23 AM
A͢J
A͢J - avatar
+ 2
Mahaveer Singh Ranawat Working fine for me
5th Jan 2022, 3:21 AM
A͢J
A͢J - avatar
+ 1
It is showing again also
5th Jan 2022, 2:35 AM
Mahaveer Singh Ranawat
0
Works well if you remove parenthesis in line one and two
5th Jan 2022, 8:18 AM
Manjunath
0
Can anyone suggest me a good java YouTube channal
6th Jan 2022, 12:21 PM
Sri Hanu
Sri Hanu - 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) 1.remove opening ( from first two lines . 2.Remove space between ' ' and semicolon for a clean code in elif statements.
6th Jan 2022, 3:46 PM
Isuru Umayanga
Isuru Umayanga - avatar
0
Idk
6th Jan 2022, 7:32 PM
niks bloks!!!
0
You have 3((( on the left and 2)) on the right.
6th Jan 2022, 8:25 PM
Jakub Daraz
Jakub Daraz - avatar
- 1
I didn't use else anywhere
5th Jan 2022, 2:05 AM
Mahaveer Singh Ranawat
- 1
It is showing syntax error in line 2
5th Jan 2022, 2:05 AM
Mahaveer Singh Ranawat
- 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)
5th Jan 2022, 2:34 AM
Mahaveer Singh Ranawat