sudo apt-get install python3.10
# to keep your previous versions, add them as alternatives to python3
# give a higher priority to the one you want to be used as the default
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
# set
sudo update-alternatives --config python3
# check if it is the default
python3