input: Write a function to convert the given Python code using a list comprehension. If the given code does not contain a loop, return the original code as a string. If the conversion is successful, return the converted list comprehension as a string. If the input code is empty, return an empty string.
  assert list_comprehension(["even_numbers = []\nfor i in range(1,21):\n    if i % 2 == 0:\n        even_numbers.append(i)"]) == "even_numbers = [i for i in range(1, 21) if i % 2 == 0]"
  assert list_comprehension(["odd_numbers = []\nfor i in range(1,21):\n    if i % 2 != 0:\n        odd_numbers.append(i)"]) == "odd_numbers = [i for i in range(1, 21) if i % 2 != 0]"
  assert list_comprehension(["single_line = 5"]) == "single_line = 5"
  assert list_comprehension([""]) == ""
  assert list_comprehension(["numbers = [i for i in range(1, 21) if i % 2 == 0]"]) == "numbers = [i for i in range(1, 21) if i % 2 == 0]"
output: def list_comprehension(code_list):
      code = code_list[0]
      if not code:
          return ""
      if "for" not in code:
          return code
      lines = code.split("\n")
      for line in lines:
          if "for" in line:
              var_name = line.split("=")[0].strip()
              loop_start = line.index("for")
              loop_end = line.index(":")
              loop_part = line[loop_start:loop_end]
              if_start = line.index("if", loop_end)
              if_end = line.index(":", if_start)
              if_part = line[if_start:if_end]
              list_comp = f"{var_name} = [{loop_part.split()[-1]} {if_part} {loop_part}]"
              return list_comp
      return code