input: Write a function to perform linear regression on a given dataset for predicting the numbers. If the dataset is provided as two lists (X and Y), the function should train a linear regression model and output the predicted value for a new input. If the input lists are empty, the function should return None.
  assert perform_linear_regression([1, 2, 3, 4, 5], [3, 5, 7, 9, 13], 7) == [17.0]
  assert perform_linear_regression([], [], 7) == None
  assert perform_linear_regression([2, 4, 6, 8], [4, 8, 12, 16], 10) == [20.0]
output: def perform_linear_regression(X, Y, new_input):
      if not X or not Y:
          return None
      n = len(X)
      sum_x = sum(X)
      sum_y = sum(Y)
      sum_xy = sum(x * y for x, y in zip(X, Y))
      sum_x2 = sum(x ** 2 for x in X)
      slope = (n * sum_xy - sum_x * sum_y) / (n * sum_x2 - sum_x ** 2)
      intercept = (sum_y - slope * sum_x) / n
      predicted_value = slope * new_input + intercept
      return [predicted_value]