input: Write a Python function to split the data into training and testing sets and train a linear regression model, then evaluate the model's accuracy.
  assert abs(train_and_evaluate_model('sample_dataset.csv') - 0.95) < 0.05
  assert abs(train_and_evaluate_model('another_dataset.csv') - 0.85) < 0.05
output: import pandas as pd
  from sklearn.model_selection import train_test_split
  from sklearn.linear_model import LinearRegression
  from sklearn.metrics import r2_score
  
  def train_and_evaluate_model(file_path):
      # Load dataset
      data = pd.read_csv(file_path)
      
      # Assume the last column is the target variable and the rest are features
      X = data.iloc[:, :-1]
      y = data.iloc[:, -1]
      
      # Split the data into training and testing sets
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
      
      # Train the linear regression model
      model = LinearRegression()
      model.fit(X_train, y_train)
      
      # Make predictions on the test set
      y_pred = model.predict(X_test)
      
      # Evaluate the model's accuracy
      accuracy = r2_score(y_test, y_pred)
      
      return accuracy