RHEL 8 install Python 3 or Python 2 using yum

Originally published at: https://www.cyberciti.biz/faq/rhel-8-install-python-3-or-python-2-using-yum/

I need to install Python 3 for Ansible IT automation tool on RHEL 8. How do I install Python 3 on RHEL 8? Is it possible to install Python 2 for legacy apps on RHEL 8?