Research Breakthrough Possible @S-Logix pro@slogix.in

Office Address

Social List

What is Interactive and Scripting Mode Programming in Python?

Interactive and Scripting Mode Programming in Python

Condition for Interactive and Scripting Mode Programming in Python

  • Description:
    In interactive mode, Python code is executed line-by-line, directly in the Python interpreter or console.In scripting mode, Python code is written in a script file (with a .py extension) and executed as a whole.
Step-by-Step Process
  • Interactive mode:
    It interacting directly with the Python interpreter,where each command is executed immediately upon entry.
  • Scripting mode:
    It involves several steps to write, save, and execute a Python script file.
    Python file have the extension(.py).So, we should save the file with .py (Eg.script.py)
Sample Code
  • Python 3.12.4 | packaged by Anaconda, Inc. | (main, Jun 18 2024, 15:12:24) [GCC
    11.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> x=10
    >>> y=20
    >>> sum=x+y
    >>> print(sum)
    30
    Source code for Scripting python
    Open any Text editor you want
    Create and save the file with .py extension
    a = 40
    b = 60
    result = a + b
    print("The Result is :",result)
Screenshots
  • Interactive and Scripting Mode
  • Interactive and Scripting Mode