input: Write a python function to perform basic arithmetic operations based on the given operator.
  assert calculater(3, 4, '+') == 7
  assert calculater(3, 4, '-') == -1
  assert calculater(3, 4, '*') == 12
  assert calculater(4, 2, '/') == 2.0
output: def calculater(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 ValueError("Invalid operator")