input: Write a function to perform linear regression for predicting the numbers in a given dataset. The function should accept two lists, X and Y, and return the predicted value of Y for a new input X.
  assert linear_regression([1,2,3,4,5], [3,5,7,9,13])==11.0
  assert linear_regression([5,6,7,8,9], [15,17,19,21,23])==25.0
  assert linear_regression([10,20,30,40,50], [100,200,300,400,500])==600.0
  assert linear_regression([2,4,6,8,10], [4,8,12,16,22])==9.0
  assert linear_regression([11,12,13,14,15], [33,35,37,39,43])==31.0
output: def linear_regression(X, Y):
      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
      
      new_X = X[-1] + 1
      predicted_Y = slope * new_X + intercept
      
      return predicted_Y