My Ubuntu 20.04 comes with Python 3.8.10, and I need to upgrade it to 3.10 for a workshop.
Here are the steps:
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get update
$ apt-get update
$ apt list | grep python3.10
$ sudo apt-get install python3.10
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
$ sudo update-alternatives --config python3
$ python3 -V