input: Write a function to perform linear regression on a given dataset and predict the value of y for a new x value. The function should take two lists, X and Y, which represent the training data, and a single value x for which the prediction is to be made. If the prediction is successful, the function should return the predicted value; otherwise, it should return False.
  assert linear_regression([1,2,3,4,5], [3,5,7,9,13], 7)==[17.]
  assert linear_regression([1,2,3,4,5], [3,5,7,9,13], 4)==[9.]
  assert linear_regression([1,2,3,4,5], [3,5,7,9,13], 0)==[1.]
  assert linear_regression([], [], 7)==False
  assert linear_regression([1], [3], 7)==[11.]
output: def linear_regression(X, Y, x):
      if len(X) == 0 or len(Y) == 0 or len(X) != len(Y):
          return False
      n = len(X)
      sum_x = sum(X)
      sum_y = sum(Y)
      sum_xy = sum([X[i] * Y[i] for i in range(n)])
      sum_x2 = sum([x ** 2 for x in X])
      m = (n * sum_xy - sum_x * sum_y) / (n * sum_x2 - sum_x ** 2)
      b = (sum_y - m * sum_x) / n
      return [m * x + b]