How To Use Console Python
The Python programming language can also be used in interactive line mode
What is Python's interactive mode? Interactive mode is an alternative to editing source code on file. It is particularly useful for me to test single features of a program during the debugging phase. Functions and commands are executed directly from the shell without a script.
How python works in interactive mode
I open the interactive python mode ( not IDLE ) to display the shell or the command line.
The shell opens with the python interpreter prompt.
Now I can type in the instructions to be executed. One after the other.
Every time I execute an instruction, python saves the result in memory.
Thus, the output of an instruction changes the result of subsequent statements as in a real program.
A practical example
On the python command line, I initialize the variable A and I assign it the numerical value A = 10.
The interpreter executes the instruction. After execution, the command line prompt reappears.
Now, I type the PRINT (A) statement to display the contents of the variable.
The interpreter returns me the value 10 in output.
The explanation is very simple. Python has stored in memory the assignment of the value 10 to the variable A (first instruction).
When I asked to display the contents of variable A, the interpreter simply read and displayed the value of the variable in memory.
For this reason, the python language is considered an interactive language.