Python Editors (Integrated Development Editors)

There are many free and commercial IDEs available for Python. Here, we will learn how to use some open-source editors to execute Python scripts or statements.

Jupyter Notebook

The Jupyter Notebook is a browser-based graphical interface to the IPython shell. It allows the user to include formatted text, static and dynamic visualizations, mathematical equations, JavaScript widgets, etc. along with the Python code. The Jupyter Notebook document can be exported to PDF, Python script, or HTML.

By default, the IPython kernel drives the Jupyter Notebook application. However, it supports other languages like Julia and R. (Jupyter stands for JUlia, PYThon, and R).

To install Jupyter, use the pip utility shipped with Python software.

pip3 install jupyter

After successful installation, we can start the Jupyter editor from the command prompt as below.

jupyter notebook

Jupyter Notebook is a client-server application. The server is deployed on the localhost's default port 8888 and the client is opened in a browser window, as shown below:

Jupyter

As you can see, Jupyter will display files and folders from the Python installation folder. You can create, open, and execute python scripts from the appropriate folders. Start a new notebook by choosing Python 3 from the "new" dropdown, as shown below:

New Python Script in Jupyter

This will open another window to enter python statements and run them as shown below.

New Python Script in Jupyter

The interface is similar to IPython shell. However, there are a lot of other advantages.

For instance, you can insert and delete cells. A cell can contain code, heading, or a markdown text, which acts as documentation. The code in any cell can be run. Another advantage is that data visualizations generated by libraries like Matplotlib can be incorporated inline.

The notebook is saved with the .ipynb extension. It can be exported to HTML or PDF format so that it can be shared.

Visual Studio Code

Visual Studio Code is an open-source IDE to develop different types of applications on Windows, Mac, and Linux platform. You can develop Python 3 applications by installing Python extension for VS Code from the Visual Studio Marketplace.

Online Python Shell

Installing Python (or any software) can be a little daunting for a newbie. Fortunately there are many online resources to get familiar with the syntax, features and philosophy of Python before deciding to install Python in the local machine.

You can launch an online Python Shell directly from the official website - https://www.python.org/shell. The Shell terminal shows a Python prompt >>> in front of which any valid Python expression can be written, which is executed on pressing 'Enter'.

Online Python Shell

Many interactive Python environment shells can be found on the internet. They work based on REPL (Read, Evaluate, Print, Loop). Using https://repl.it it is possible to execute Python in interactive as well as in scripting mode.

Python - repl.it

The right-hand column in the above diagram is an interactive shell, whereas a Python script can be entered and run in the left pane.

Learn about the basic syntax of Python in the next chapter.