input: Write a python function to create a simple calculator that can add or subtract two numbers based on user input.
  assert calculator("add", 5, 3) == 8
  assert calculator("subtract", 10, 4) == 6
  assert calculator("add", -1, -1) == -2
  assert calculator("subtract", 100, 50) == 50
output: def calculator(operation, num1, num2):
      if operation == "add":
          return num1 + num2
      elif operation == "subtract":
          return num1 - num2