input: Write a python function to install packages using subprocess in Python.
  assert install_packages(['python3-pip', 'virtualenv'])==0
  assert install_packages(['nonexistent-package'])!=0
output: def install_packages(packages):
      import subprocess
      result = subprocess.run(['sudo', 'apt-get', 'install', '-y'] + packages)
      return result.returncode