input: Write a python function to calculate the Pearson correlation coefficient.
  assert abs(pearson_coefficient([2, 4, 7, 9], [6, 8, 12, 14]) - 0.998) < 1e-3
  assert abs(pearson_coefficient([1, 2, 3], [1, 2, 3]) - 1.0) < 1e-3
  assert abs(pearson_coefficient([1, 2, 3], [3, 2, 1]) + 1.0) < 1e-3
output: def pearson_coefficient(x, y):
      if len(x) != len(y):
          raise ValueError("The lists x and y must have the same number of elements.")
      
      n = len(x)
      sum_x = sum(x)
      sum_y = sum(y)
      sum_xy = sum(xi * yi for xi, yi in zip(x, y))
      sum_x2 = sum(xi ** 2 for xi in x)
      sum_y2 = sum(yi ** 2 for yi in y)
      
      numerator = (n * sum_xy) - (sum_x * sum_y)
      denominator = ((n * sum_x2 - sum_x ** 2) * (n * sum_y2 - sum_y ** 2)) ** 0.5
      
      if denominator == 0:
          return 0
      
      return numerator / denominator