Check the Python version from the command line and in the Python script

import os


def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press ⌘F8 to toggle the breakpoint.


def ver_Py3():
    #checking using cmd
    #python --version
    #using python script to get version
    os.system("python --version")
    os.system("python -V")
    os.system("python -VV")

/Users/leonidassavvides/PycharmProjects/pythonProject2/venv/bin/python /Users/leonidassavvides/PycharmProjects/pythonProject2/main.py
Hi, PyCharm
Python 3.10.4
Python 3.10.4
Python 3.10.4 (v3.10.4:9d38120e33, Mar 23 2022, 17:29:05) [Clang 13.0.0 (clang-1300.0.29.30)]

Process finished with exit code 0

The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
(venv) leonidass-mbp:pythonProject2 leonidassavvides$ python --version
Python 3.10.4
(venv) leonidass-mbp:pythonProject2 leonidassavvides$ python -V
Python 3.10.4
(venv) leonidass-mbp:pythonProject2 leonidassavvides$ python -VV
Python 3.10.4 (v3.10.4:9d38120e33, Mar 23 2022, 17:29:05) [Clang 13.0.0 (clang-1300.0.29.30)]