There are 3 main ways to execute a python script.
1) Interactive Prompt>
2) IDE
3) Command Line
This is mostly used for experimenting and testing. Although you can write out long codes here, you should switch over to a file if you plan to write more than 3-5 lines. An IDE or file would be more appropriate and easier. The >>> is the prompt for interactive mode. What you type here is python code. It will be executed right after you hit Enter. The only time it does not execute after Enter is when you are defining a function or class or a loop, for example. The ... will indicate that you are inside the block of what you are defining. Once you finish writing the code inside the block, you must hit Enter twice, where it will execute and take you back to the >>> prompt depending on what you are defining.
The reason the interactive prompt is for testing is because:
1) it will execute upon each line or after the definition of a loop, class, function, etc.
2) Once you exit the interactive prompt, what code you wrote in it, is gone. There is no saving the code.
The other two methods of executing python code will save a file with your code in it.
Windows
Click on Start Menu -> (on search) type: "command prompt". A Black icon "cmd" or Command prompt" will show up. Or open c:\Windows\system32\cmd.exe which will do the same. This is a DOS prompt. You can do everything you can do normally on the PC in this DOS prompt with commands. The text before your cursor is the directory you are currently in. The command "cd" will change your current directory to the string after. The command 'dir' will list the directories in that directory that you are in. PythonXX should be in the directory C:\PythonXX (where XX represent the version you have downloaded). Once in the directory: type "python" to execute the interactive prompt.
If you see ">>>", then you are in in the python interactive prompt.
Linux
Open a Terminal. It does not matter what directory you are in. If you have both python2.x and python3.x installed, you can use either interactive prompt by a number. "python" is the default for your OS. The default may be python3.x in some distros (currently now is gentoo and arch)
python2.x
python3.x
Each IDE is different in how you configure it, execute code, etc. Some have a run command, and F# key, etc. to execute the python code. Some will open a terminal/console with for the output, some will have embedded terminals, and some will have their own area for output. Some will have all of these options, some will have only a few of these options.
What is IDLE? IDLE is just only one of the numerous IDE's.
Also by most programmers, it is also considered one of the worst IDE's too.
It shall be fine for beginner's though. You can research why with a google search later, or run across the reasons yourself as you progess in programming.
For those that stick with IDLE, IDLE starts you off with the python interpreter.
This is not a DOS prompt! It is just a GUI form of the python interpreter that you can also get in the DOS prompt/terminal.
It confuses a lot of beginner's because they think they click new window, write their code, and run their code in the python interpreter, thinking it is a DOS prompt or terminal.
For Windows simplicity: put this test.py file in your directory that you started the interactive prompt: for example of the path:
and example of the same path executed:
Then you open a Terminal/DOS prompt and change directory to your test.py and write this:
The same as before like with the interactive prompt, but this time we add a argument and the argument is your .py file.
This example shows the creation and execution of a one line python script. 'touch tester.py' creates the file, although vim will create it anyways. 'vim tester.py' opens one of the numerous text editors. Remember, you can use anything. 'cat tester.py' shows the content of the .py file that i wrote in it, in vim. 'python3 tester.py' executes the script I made with python3.x. 'this is a test' is the output of that program executed.