Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calc():
- input1 = input("INPUT1")
- input2 = input("INPUT2")
- if input1 not in "+-*/" and input2 not in "+-*/":
- return (input1,input2)
- if input2 in "+-*/":
- if input2 == "+":
- temp = calc()
- input2 = s(temp[0],temp[1])
- elif input2 == "-":
- temp = calc()
- input2 = mi(temp[0],temp[1])
- elif input2 == "*":
- temp = calc()
- input2 = mu(temp[0],temp[1])
- else:
- temp = calc()
- input2 = d(temp[0],temp[1])
- input3 = input("INPUT3")
- if input3 in "+-*/":
- if input3 == "+":
- temp = calc()
- input3 = s(temp[0],temp[1])
- elif input3 == "-":
- temp = calc()
- input3 = mi(temp[0],temp[1])
- elif input3 == "*":
- temp = calc()
- input3 = mu(temp[0],temp[1])
- else:
- temp = calc()
- input3 = d(temp[0],temp[1])
- if input1 == "+":
- return s(input2,input3)
- elif input1 == "-":
- return mi(input2,input3)
- elif input1 == "*":
- return mu(input2,input3)
- elif input1 == "/":
- return d(input2,input3)
- def s(lhs,rhs):
- print(lhs)
- print(rhs)
- return int(lhs) + int(rhs)
- def mi(lhs,rhs):
- print(lhs)
- print(rhs)
- return int(lhs) - int(rhs)
- def mu(lhs,rhs):
- return int(lhs) * int(rhs)
- def d(lhs,rhs):
- return int(lhs) // int(rhs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement