0

I didt get any output

num1=int(input("enter number 1")) num2=int(input("enter nunber 2")) op=input("enter operation , add,sub,mul,div") add=num1+num2 sub=num1-num2 if op ==add: print(add) elif op == sub: print(sub) ............

16th Jul 2017, 2:01 PM
Nisan Abeywickrama
Nisan Abeywickrama - avatar
2 odpowiedzi
+ 7
you need "" around add and sub. Without it, they would be considered variables and it would seeing if the input was the same as the value the vars contained. num1=int(input("enter number 1")) num2=int(input("enter nunber 2")) op=input("enter operation , add,sub,mul,div") add=num1+num2 sub=num1-num2 if op =="add": print(add) elif opp == "sub": print(sub) ............ I think this is right. I'm not great at Python, so maybe it is wrong.
16th Jul 2017, 2:10 PM
J.G.
J.G. - avatar
+ 6
One more thing-- the way you have it, neither of your if statements would evaluate to true, so nothing is printed, because you have no print statements outside the if statements.
16th Jul 2017, 2:11 PM
J.G.
J.G. - avatar