Python can be used as both
interactive or script mode.
Interactive Mode – The
Interactive mode can be used by starting the interpreter provided by
Python. This can be done by executing the “python” command in the Shell as,
Executing your first “Hello
World “ Program with the Interactive mode is Quite Simple. Enter the below at
the command mode provided ( after the >>> )
Print “hello World”
The Output the command Is
displayed there it-self allowing developers to test and debug their snippets of
code. To come out of the Interpreter , we can use “CTRL + D” .
Script Mode - Invoking the
interpreter with a script parameter begins execution of the script and
continues until the script is finished. When the script is finished, the
interpreter is no longer active.
Open a file using the VI Editor
and enter the below statement and Save as filename.py (Python files have
extension.py)
Print “Hello World”
Now invoke the interpreter
using the save file as
:) [xprk477@vx181d /tmp]$
python /tmp/hai.py
Hello World
No comments :
Post a Comment