input: Write a function to design a Python program that performs linear regression for predicting the numbers in a given dataset. The function should take two lists X and Y as input, where X represents the independent variable and Y represents the dependent variable. The function should return the predicted value of Y for a given value of X.
  assert linear_regression([1, 2, 3, 4, 5], [3, 5, 7, 9, 13], 7) == 15.0
  assert linear_regression([2, 4, 6, 8, 10], [4, 8, 12, 16, 20], 12) == 24.0
  assert linear_regression([1, 3, 5, 7, 9], [2, 4, 6, 8, 10], 11) == 12.0
  assert linear_regression([1, 2, 3, 4], [1, 3, 5, 4], 5) == 4.4
  assert linear_regression([], [], 0) == None
output: def linear_regression(X, Y, x):
      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_X_squared = sum(x ** 2 for x in X)
      slope = (n * sum_XY - sum_X * sum_Y) / (n * sum_X_squared - sum_X ** 2)
      intercept = (sum_Y - slope * sum_X) / n
      return slope * x + intercept