Python – IDLE

Created with Sketch.

Python – IDLE

IDLE (Integrated Development and Learning Environment) is an integrated development environment (IDE) for Python.
The Python installer for Windows contains the IDLE module by default.

IDLE is not available by default in Python distributions for Linux. It needs to be installed using the respective package managers. For example, in case of Ubuntu:


$ sudo apt-get install idle

IDLE can be used to execute a single statement just like Python Shell and also to create, modify and execute Python scripts.
IDLE provides a fully-featured text editor to create Python scripts that includes features like syntax highlighting, autocompletion and smart indent.
It also has a debugger with stepping and breakpoints features.

To start IDLE interactive shell, search for the IDLE icon in the start menu and double click on it.



Python IDLE

This will open IDLE, where you can write Python code and execute it as shown below.



Python IDLE

Now, you can execute Python statements same as in Python Shell as shown below.



Python IDLE

To execute a Python script, create a new file by selecting File -> New File from the menu.



Enter multiple statements and save the file with extension .py using File -> Save. For example, save the following code as hello.py.



Python Script in IDLE

Now, press F5 to run the script in the editor window. The IDLE shell will show the output.



Python Script Execution Result in IDLE

Thus, it is easy to write, test and run Python scripts in IDLE.

 

Leave a Reply

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