sudo apt-get update subprocess returned an error code

Use update-alternatives to put the default python version back to what it was. I am also running Ubuntu 18.04 my python version is 2.7.15

$ python --version
Python 2.7.15+

Then I would recommend looking into setting up virtual python environments using venv (venv in python3 and virtualenv for python2) for testing or running programs that require python 3.

First, make sure you have pip installed by running sudo apt install python3-pip or ensure that it is up to date by running python3 -m pip install --user --upgrade pip.

Then install venv by running python3 -m pip install --user virtualenv

I hate to link you to an outside webpage but there are clear instructions on doing this on the python.org website. You can find a link to the site at here