input: Write a function to efficiently edit the given Python code so that it uses list comprehension instead of a for loop and if statement to filter elements greater than 2 from the list. The function should return the modified code as a string.
  assert efficient_edit("data = [1, 2, 3, 4]\nresult = []\nfor x in data:\n if x > 2:\n  result.append(x)") == "data = [1, 2, 3, 4]\nresult = [x for x in data if x > 2]"
output: def efficient_edit(code):
      lines = code.split('\n')
      data_line = lines[0]
      result_line = f"result = [x for x in {data_line.split('=')[1].strip()} if x > 2]"
      return '\n'.join([data_line, result_line])