input: Write a python function to perform basic arithmetic operations based on given operator and numbers.
  assert calculator('+', 10, 5) == 15
  assert calculator('-', 10, 5) == 5
  assert calculator('*', 10, 5) == 50
  assert calculator('/', 10, 5) == 2
  assert calculator('/', 10, 0) == "Invalid operator"
output: def calculator(operator, num1, num2):
      if operator == '+':
          return num1 + num2
      elif operator == '-':
          return num1 - num2
      elif operator == '*':
          return num1 * num2
      elif operator == '/':
          if num2 == 0:
              return "Invalid operator"
          return num1 / num2
      else:
          return "Invalid operator"