When you install Python on Windows, the installer has a checkbox to add the path to the Python folders to the PATH variable. You have two possibilities:
Python not in PATH: You must use the py command (C:\Windows\py.exe). In a command or terminal window, using the py command starts Python in interactive mode, and using py script.py will have Python run the script.py program.
Python in PATH: You may use the py command as described above. You can also use the python command to enter interactive mode or the python script.py command to have Python run the script.py program.
Linux and MacOS do not have a py command so they always uses the python or python3 commands.
If you want to use py -c “code” or python -c “code”, on Windows, you must use the double quote characters around the entire code string. Embedding double quote characters in the code string is difficult, so it is better to try to use single quotes or triple single quotes between the double quotes instead.
On Linux or MacOS, you can use either the single or double quote character (depending on shell quoting requirements for code).