Run Python code
There are multiple ways to run the Python code. Here are the most common launching techniques:
1. the interactive prompt – this is the simplest way to run your Python programs. You simply type the code in this command-line interface. To access the interactive prompt, type python in the Windows command prompt or Linux shell and press Enter:
2. IDLE (Python GUI) – a graphical user interface where you can write your Python code. This IDLE is free and it is installed automatically during the Python installation. It enables you to edit, run, and debug Python programs in a nice GUI environment:
3. the command line – you can save your code in a file and run that file in the Windows command prompt or Linux shell. The files in which the code is saved usually have the .py extension. The code is run by specifying the filename after the python keyword:
In the picture above you can see that we’ve executed a file called example.py. If the Python directory is not listed in the PATH variable, you will need to enter the full path to the python.exe program.