Interactive Mode Programming
Invoking the interpreter without passing a script file as a parameter. The code executes via the Python shell, which comes with Python installation. Interactive mode is handy where we can just execute basic Python commands or our new Python Programming.
Example:
>>> print "Hello, Python!"
Hello Python!
>>>
Script Mode Programming
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.
If developer need to write a long piece of Python code or Python script spans multiple files, interactive mode is not recommended. Script mode is the way to go in such cases. In script mode, we write our code in a text file then save it with a .py
extension which stands for "Python".
Example:
print("Hello World")
Output: Hello World
Tags