0
am kinda having problem problem applying d if and elif especially with the == stuff I tried building a calculator but I can't get it to respond or reply cause I keep on getting error at user input
2 Réponses
+ 3
Here is how you can do it:
a = int(input("operand1?"))
b = int(input("operand2?"))
op = input("operator?)
if op == "+":
print(str(a+b))
elif op == "-":
print(str(a-b))
#etc.
+ 1
What exactly is the problem? if you are trying to get input from the user use something like this:
inputstr1 = input("Enter a equation/problem: ")
This will give you the input as a string.