Python IDLE (IDE)

In the previous chapter, we learned how to install python on different OS machines. In case if you didn’t install python, check the python installation article.

 

When you install python on your machine by default, it will install the python interpreter/shell, IDLE, and other required components to implement the applications using the python programming language.

 

The Python IDLE (Integrated Development and Learning Environment) is an integrated development environment (IDE) component to build applications using the python programming language.

 

The Python IDLE is a decent text editor, and it has features like code hinting, syntax highlighting, file explorers, etc. to make developer life easy during the application development. 

 

The Python IDLE is useful for creating, modifying, and executing the script files and single statements based on our requirements.

 

To start Python IDLE, search for IDLE in the start menu and click on the IDLE app like as shown below.

 

Search for Python IDLE Component

 

After opening the Python IDLE interface, you will see the greater than (>>>) symbols like as shown below, that means you are ready to start typing your code.

 

Python IDLE or IDE Interface

 

If you want, you can perform different operations in python idle like as shown below.

 

Python idle with different examples

Create Script File in Python IDLE

By using Python IDLE, you can create, modify, and execute script files. To create a new python script file, go to File à Select New File from the menu, as shown below.

 

Python idle create new script file

 

After creating the new file, write the code as shown below and save the file with .py extension.

 Python idle save script file

Execute Script File in Python IDLE

If you observe the above image, we saved the file with a pythonexample.py name. In the editor window, to execute the python script file, go to Run à select Run Module or press F5. The Python IDLE shell will show the result as shown below.

 

Python idle file execution result

 

Like this, you can use the python IDLE editor to create, write, and execute the python programs based on your requirements.

 

Like Python IDLE editor, we have other popular open-source editors available to build the python applications. In the next chapter, we will learn more about it.