Python Editors (IDE)

In the previous chapter, we learned how to use the default Python IDLE editor to execute the python script files and statements. Like Python IDLE editor, we have different free and commercial python editors are available to build applications using python language.

 

Python Editor is an IDE (Integrated Development Environment) component. It will provide features like code hinting, syntax highlighting, code indentation, etc. to make developer life easy while creating and executing the python scripts or statements.

 

Now, we will learn a few of the best free, open-source python editors to create, modify, and execute the python script files as well as single statements based on our requirements.

PyCharm IDE

PyCharm is one of the most popular free open-source Python IDE to write the python programs. The PyCharm editor has built by JetBrains, and it includes features like smart code completion, code refactoring, unit testing, code debugger, etc. to build Python applications easily.

 

To download and install PyCharm python editor, visit PyCharm Editor. After completion of PyCharm installation, open the PyCharm editor to create a new python project.

 

Pycharm editor for python

 

After opening the PyCharm window, click on the Create New Project option. It will open the New Project window for configuration like as shown below.

 

Create python application using pycharm editor

 

If you observe the above image, the project location pointed to untitled, instead of untitled, change the project location to helloworld and click on the Create button.

 

After creating the project, right-click on the helloworld project folder in the sidebar and select New à Python File, as shown below.

 

Pycharm editor create python application

 

When you click on the Python File, it will prompt you to enter the python file's name. Give the file name (Ex: Welcome) and click Enter to create the file.

 

Now open the file and write the code like as shown below.

 

Write python code in pycharm editor

 

To execute the code, right-click on the code that you typed and click on RunWelcome’ like as shown below.

 

Execute python code in pycharm editor

 

When you click on the Run ‘Welcome’ option, it will execute the code and return the result like as shown below.

 

Pycharm editor python code execution result

 

You can use JetBrains Pycharm IDE to create, modify, and execute python scripts and single-line statements based on your requirements.

Thonny IDE

Another useful Python IDE is Thonny IDE. By default, the latest version python bundled with Thonny IDE. So, you don’t have to install Python separately.

 

To download and install Thonny IDE, visit Thonny Editor. After download, run the installer to install Thonny IDE on your machine.

 

After completing Thonny IDE installation, open Thonny IDE, Go to File à select New and save the file with .py extension and write the code like as shown below.

 

Thonny editor write python code

 

To execute the python script (Helloworld.py), Go to Run à select Run Current Script or press F5. When you execute the above python script, you will get the result like as shown below.

 

Thonny editor execute python code

Python for Visual Studio Code Editor

By installing Python Extension for Visual Studio Code editor, you can easily create python applications using Visual Studio Code editor.

 

After installing the Python Extension, the VS Code editor will provide IntelliSense, code formatting, debugging, refactoring, etc. support while writing the code in python language.

 

Like this, different python editors are available to use it for your python application development.

Python IDE Online

Instead of installing python on local machines, you can use online Python IDEs to get familiar with python programming. There are many online Python IDE resources available to write and execute the python programs.

 

The official python site itself has provided a Python Shell to execute the python programs online. When you open the Python Shell, you will see greater than (>>>) symbols to start type your code when the terminal is ready like as shown below.

 

Python shell online editor

 

If you want, you can perform different operations based on your requirements.

 

Like this, we have different online interactive Python Editors available to execute the code without installing the Python on our local machines. Following is the repl interactive shell to execute the python online.

 

python repl interactive shell to execute python code online

 

The code whatever you want to execute that code needs to be entered in the left pane, and if you click on the Run button, it will compile and show the result in the right pane.