Python Interactive Shell

Python can be run in the interactive shell by launching IDLE, which is installed with python.
On windows, open the Start menu, select All programs > Python 3.7 and then select IDLE (Python GUI).
On OS X, select Applications > MacPython 3.7 > IDLE.
On Ubuntu, open a new Terminal window and enter idle3.
A window will appear then. This window is called the interactive shell. A shell is a program that lets you type instructions in the computer. Python's interactive shell lets you to give instructions for the Python interpreter to run. After you type a line and press ENTER then the computer read the instructions and runs them immediately. An example is given below:

  1. >>> print("Hello, World!")
  2. Hello, World!

First Python Program

While the interactive shell is working perfectly, to write entire Python programs you have to write the instruction into the file editor. The file editor can be similar to text editors such as Notepad. To open the file editor in IDLE, select File > New Window. The new window is different from the interactive shell. The interactive shell runs instructions immediately as soon as press ENTER. But the file editor lets you type in many instructions then save the file and run the program.
Once you have entered your entire program in the editor you should save it. The file extension must be .py for python program such as hello.py.
Once You have saved then for running the program select Run > Run Module or just press the F5 key. Then the program should run in the interactive shell window. Remind that you have to press the F5 button from the file editor window not from the interactive shell window.


Python Indentation

Most of the programming languages like C, C++, Java use braces { } to define a block of code. Python uses indentation. Indentation means the spaces at the beginning of a code line. In the other programming language indentation is just for readability only but in python it is very very important to use the indentation. If you skip the indentation python will give you an error. Here is an example using of indentation:

  1. if num > 0:
  2. print("Positive Number.")