input: Write a function to perform basic arithmetic operations.
  assert calculate(3, 5, '+') == 8
  assert calculate(10, 2, '-') == 8
  assert calculate(4, 7, '*') == 28
  assert calculate(20, 4, '/') == 5
output: def calculate(a, b, operator):
      if operator == '+':
          return a + b
      elif operator == '-':
          return a - b
      elif operator == '*':
          return a * b
      elif operator == '/':
          return a / b