Skip to main content

Interactive Mode and Script Mode in Python

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.


>>> 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".


print("Hello World")

Output: Hello World

Submitted by devanshi.srivastava on July 3, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.