Command line
You can save your code in a file (usually with the extension .py) and run that file in the Windows command prompt or Linux shell. The file can be executed by specifying its name after the python keyword.
Here is an example. Type the following code in the text editor of your choice (it can even be Notepad) and save the file as example.py:
x = 5 y = 10 z = x + y print (z)
The code above will simply add two numbers and print the result. To execute the code, open the Windows command prompt (or Linux shell) and enter python example.py:
You might need to use the full path to the file example.py (e.g. python c:\Python34\Scripts\example.py). If the Python directory is not listed in the PATH variable, you will also need to enter the full path to the python.exe program (C:\Python34\python.exe\example.py).
You can provide a number of options to the python command. You can display them by typing python /? in the Command prompt:
For example, to display the Python version, use the python -V command:
C:\Python34\Scripts>python -V Python 3.4.3