input: Write a function to edit the given Python code to be more efficient by using list comprehension. The function should accept a list `data` as input and return a list `result` that contains elements greater than 2. If the input list is empty, it should return an empty list.
  
  assert optimize_code([1, 2, 3, 4])==[3, 4]
  assert optimize_code([1, 2, 5, 6])==[5, 6]
  assert optimize_code([1, 2])==[]
  assert optimize_code([])==[]
output: def optimize_code(data):
      return [x for x in data if x > 2]