- 3

Plz..help me

Enter two integers and operators from the user and create a program that corresponds to the operator you entered. (You create a program to calculate any of the operators (+,-,*) that are entered.) integer input:5 operator input:+ integer input:3 5+3=8

27th Mar 2022, 1:32 PM
Hi i
35 Respostas
+ 2
Hi i Take inputs with separate lines like this: 5 + 3 SoloLearn support all inputs together only once
27th Mar 2022, 1:50 PM
A͢J
A͢J - avatar
+ 1
Your try?
27th Mar 2022, 1:34 PM
Jayakrishna 🇮🇳
+ 1
Oh, it's done! Thank you.
27th Mar 2022, 3:51 PM
Hi i
0
If you show your try then I will ..
27th Mar 2022, 1:36 PM
Jayakrishna 🇮🇳
0
You have already got your answer here https://www.sololearn.com/Discuss/3007740/?ref=app
27th Mar 2022, 1:39 PM
A͢J
A͢J - avatar
0
but the answer is wrong..
27th Mar 2022, 1:39 PM
Hi i
0
Please refrain from re-posting similar question. If you have a doubt, then you can confirm with the people who contributed answers in your post rather than reposting. https://www.sololearn.com/Discuss/3007740/?ref=app
27th Mar 2022, 1:39 PM
Ipang
0
Hi i Do you expect only 8 or 5 + 3 = 8?
27th Mar 2022, 1:41 PM
A͢J
A͢J - avatar
0
Yes
27th Mar 2022, 1:41 PM
Hi i
0
Hi i What yes? 8 or 5 + 3 = 8
27th Mar 2022, 1:42 PM
A͢J
A͢J - avatar
0
5+3=8
27th Mar 2022, 1:42 PM
Hi i
0
Then this is right solution which was in previous question ---------- num1 = input("") operator = input("") num2 = input("") print((num1 +operator+ num2 +"=")+str(int(eval(num1 +operator+ num2))))
27th Mar 2022, 1:43 PM
A͢J
A͢J - avatar
0
but Traceback (most recent call last): File "file0.py", line 2, in <module> b= input("+") EOFError: EOF when reading a line It comes out like this.
27th Mar 2022, 1:47 PM
Hi i
0
Hi i Don't write + inside input function Try this code: ------ num1 = int(input()) operator = input() num2 = int(input()) print((str(num1) + operator + str(num2) + "=")+ str(int(eval(str(num1) + operator + str(num2)))))
27th Mar 2022, 1:48 PM
A͢J
A͢J - avatar
0
Okay
27th Mar 2022, 1:50 PM
Hi i
0
The error keeps popping up…
27th Mar 2022, 1:53 PM
Hi i
0
Hi i Show how did you write code? And how did you take inputs? Take screenshot upload in Feed Posts and share the link here.
27th Mar 2022, 1:56 PM
A͢J
A͢J - avatar
0
a=int(input("5")) b=input("+") c=int(input("3")) print(str(x)+y+str(z)+"=")+str(int(eval(str(x)+y+str(z)))) Write this..
27th Mar 2022, 1:59 PM
Hi i
0
a=int(input()) op=input() b=int(input()) if op == '+' : print("a + b =", a+b) # you can continue this with elseif to make remaining operations.. hope it helps. edit: Hi i x=int(input()) y=input() z=int(input()) print((str(x)+y+str(z)+"=")+str(int(eval(str(x)+y+str(z))))) #you are taking input to a, b, c but using x, y, z
27th Mar 2022, 2:06 PM
Jayakrishna 🇮🇳
0
Hi i I already told don't write anything inside input function. And please copy my code and take input like: 5 + 3 Now press enter
27th Mar 2022, 2:11 PM
A͢J
A͢J - avatar