SHARE
TWEET

Untitled

a guest Feb 22nd, 2020 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def calc():
  2.     input1 = input("INPUT1")
  3.     input2 = input("INPUT2")
  4.     if input1 not in "+-*/" and input2 not in "+-*/":
  5.         return (input1,input2)
  6.     if input2 in "+-*/":
  7.         if input2 == "+":
  8.             temp = calc()
  9.             input2 = s(temp[0],temp[1])
  10.         elif input2 == "-":
  11.             temp = calc()
  12.             input2 = mi(temp[0],temp[1])
  13.         elif input2 == "*":
  14.             temp = calc()
  15.             input2 = mu(temp[0],temp[1])
  16.         else:
  17.             temp = calc()
  18.             input2 = d(temp[0],temp[1])
  19.     input3 = input("INPUT3")
  20.     if input3 in "+-*/":
  21.         if input3 == "+":
  22.             temp = calc()
  23.             input3 = s(temp[0],temp[1])
  24.         elif input3 == "-":
  25.             temp = calc()
  26.             input3 = mi(temp[0],temp[1])
  27.         elif input3 == "*":
  28.             temp = calc()
  29.             input3 = mu(temp[0],temp[1])
  30.         else:
  31.             temp = calc()
  32.             input3 = d(temp[0],temp[1])
  33.     if input1 == "+":
  34.         return s(input2,input3)
  35.     elif input1 == "-":
  36.         return mi(input2,input3)
  37.     elif input1 == "*":
  38.         return mu(input2,input3)
  39.     elif input1 == "/":
  40.         return d(input2,input3)
  41.  
  42. def s(lhs,rhs):
  43.     print(lhs)
  44.     print(rhs)
  45.     return int(lhs) + int(rhs)
  46. def mi(lhs,rhs):
  47.     print(lhs)
  48.     print(rhs)
  49.     return int(lhs) - int(rhs)
  50. def mu(lhs,rhs):
  51.     return int(lhs) * int(rhs)
  52. def d(lhs,rhs):
  53.     return int(lhs) // int(rhs)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top