input: Write a function to create a basic Python script for participating in a Kaggle competition. The function should take the path to a CSV file containing the training data, split the data into training and testing sets, train a model on the training data, make predictions on the test data, and calculate the accuracy score of the predictions. The function should not submit the prediction to Kaggle, but it should return the accuracy score. The file path should be the only argument to the function.
  assert kaggle_competition_script("data.csv") == 0.95
  assert kaggle_competition_script("other_data.csv") == 0.92
  assert kaggle_competition_script("empty_data.csv") == None
  assert kaggle_competition_script("malformed_data.csv") == None
output: def kaggle_competition_script(file_path):
      try:
          import pandas as pd
          from sklearn.model_selection import train_test_split
          from sklearn.ensemble import RandomForestClassifier
          from sklearn.metrics import accuracy_score
          
          data = pd.read_csv(file_path)
          if data.empty:
              return None
          
          X = data.iloc[:, :-1]
          y = data.iloc[:, -1]
          
          X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
          
          model = RandomForestClassifier()
          model.fit(X_train, y_train)
          
          y_pred = model.predict(X_test)
          accuracy = accuracy_score(y_test, y_pred)
          
          return accuracy
      except Exception:
          return None