input: Write a python function to perform basic arithmetic operations.
  assert calculator(10, 5, "+") == 15
  assert calculator(10, 5, "-") == 5
  assert calculator(10, 5, "*") == 50
  assert calculator(10, 5, "/") == 2
  assert calculator(10, 5, "%") == Exception("Invalid operator")
output: def calculator(a, b, operator):
      if operator == "+":
          return a + b
      elif operator == "-":
          return a - b
      elif operator == "*":
          return a * b
      elif operator == "/":
          return a / b
      else:
          raise Exception("Invalid operator")