input: Write a python function to predict the price of an apartment using LinearRegression model from sklearn.
  assert predict_apartment_price([2, 50, 'New York'])==prediction
  assert predict_apartment_price([3, 70, 'Los Angeles'])==prediction
  assert predict_apartment_price([1, 30, 'Chicago'])==prediction
output: def predict_apartment_price(features):
      from sklearn.linear_model import LinearRegression
      import numpy as np
      
      # Example training data
      # This should be replaced with real training data
      X_train = np.array([[2, 50, 1], [3, 70, 2], [1, 30, 3]])  # Features: [rooms, size, city_code]
      y_train = np.array([500000, 800000, 300000])  # Example prices
  
      # Encode city names to integers
      city_encoding = {'New York': 1, 'Los Angeles': 2, 'Chicago': 3}
      city_code = city_encoding.get(features[2], 0)
      
      # Prepare the feature array for prediction
      input_features = np.array([[features[0], features[1], city_code]])
      
      # Train the model
      model = LinearRegression()
      model.fit(X_train, y_train)
      
      # Make prediction
      prediction = model.predict(input_features)[0]
      
      return prediction