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 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.
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.
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.
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.
To execute the code, right-click on the code that you typed and click on Run ‘Welcome’ like as shown below.
When you click on the Run ‘Welcome’ option, it will execute the code and return the result like as shown below.
You can use JetBrains Pycharm IDE to create, modify, and execute python scripts and single-line statements based on your requirements.
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.
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.
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.
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.
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.
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.