From Python.org, and Python 3.9.2, download the macOS 64-bit intel Installer. This should land in your Downloads folder and is a proper macOS installer. It will install Python 3.9.2 into /Library/Frameworks/Python.frameworks, and create links from its binaries (python3, idle3, pip3, etc.) into /usr/local/bin. It also installs a Python 3.9 folder in your /Applications folder and modifies your PATH statement in your ~/.bash_profile file.
Your initial PATH statement needs to access /usr/local/bin before other PATH locations:
export PATH=".:$HOME/bin:/usr/local/bin:$PATH"
and the Python 3.9.2 installation updates this to the following in your Bash ~/.bash_profile:
PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
Your Python scripts should either contain the first line to run Python3 code:
#!/usr/bin/env python3
which would allow you to run them from the Terminal after making them executable, and with or without that first line preamble, you can also run them via:
python3 ./script.py
Remember that the python 2.7.16 that is pre-installed on Mojave can only be run by using the command python, not python3.
Cannot help you delete anything installed from the Termina until you share what it was, and what command you used to install it.