Python Modes Of Programming

You can run your Python code in two different ways.

  1. Interactive Mode
  2. Script Mode

(1) Interactive Mode Of Writing

  • The Interactive mode of writing provides us with a quick way of running blocks or a single line of Python code.
  • Interactive mode is handy when you just want to execute basic Python commands or you are new to Python programming.

Tools Used For Interactive Mode

  1. Jupyter Notebook
  2. Python IDLE

Jupyter Notebook

Python IDLE

Advantages:

  • Helpful when your script is extremely short and you want immediate results.
  • Good for beginners who need to understand Python basics.

Disadvantages:

  • Editing the code in interactive mode is hard as you have to move back to the previous commands or else you have to rewrite the whole command again.
  • It’s very tedious to run long pieces of code.

(2) Script Mode Of Writing

  • If in your project you need to write a long piece of Python code or your Python script spans multiple files, the interactive mode is not recommended.
  • Script mode is the way to go in such cases.
  • You need to use Script Mode when you are working on a big project having multiple folder structures containing multiple files.

Advantages:

  • It is easier to run large pieces of code.
  • Editing your script is easier in script mode.
  • Good for both beginners and experts.

Disadvantages:

  • It can be tedious when you need to run only a single or a few lines of code.
  • You must create and save a file before executing your code.

Tools Used For Script Mode :

  • PyCharm
  • Spyder

PyCharm

Spyder

Leave a Reply

Your email address will not be published. Required fields are marked *