input: Write a function to predict the customer lifetime value given a customer's past transactions using a machine learning model. The function should preprocess the data, train the model using a RandomForestRegressor, and return the predicted lifetime value. If no transactions are provided, return 0.
  import pandas as pd
  import numpy as np
  
  from sklearn.preprocessing import StandardScaler
  from sklearn.ensemble import RandomForestRegressor
  
  def predict_ltv(transactions):
      if len(transactions) == 0:
          return 0
      df = pd.DataFrame(transactions)
      X = df.iloc[:,:-1].values
      y = df.iloc[:,-1].values
      scaler = StandardScaler()
      X = scaler.fit_transform(X)
      model = RandomForestRegressor()
      model.fit(X, y)
      trans_scaled = scaler.transform(np.array([transactions[-1][:-1]]))
      predicted_LTV = model.predict(trans_scaled)[0]
      return predicted_LTV
  
  assert predict_ltv([[10, 100, 4], [5, 50, 3], [15, 150, 5]])==5.0
  assert predict_ltv([])==0
  assert predict_ltv([[10, 100, 100], [20, 200, 200]])==200.0
  assert predict_ltv([[5, 25, 15], [7, 35, 21]])==21.0
  assert predict_ltv([[30, 300, 60], [35, 350, 70]])==70.0
output: def predict_ltv(transactions):
      if len(transactions) == 0:
          return 0
      df = pd.DataFrame(transactions)
      X = df.iloc[:,:-1].values
      y = df.iloc[:,-1].values
      scaler = StandardScaler()
      X = scaler.fit_transform(X)
      model = RandomForestRegressor()
      model.fit(X, y)
      trans_scaled = scaler.transform(np.array([transactions[-1][:-1]]))
      predicted_LTV = model.predict(trans_scaled)[0]
      return predicted_LTV