IDLE stands for Integrated Development Learning Environment.
It helps us to write codes and executes them.Python also has document present in software which consists of information about various functions.
Anyone can learn python using these documents and create own codes.
IDLE supports two modes of scripting : Interactive Mode and Script Mode
Interactive Mode
In this mode whatever functions or commands are written they get executed immediately and gives out result after executing each line.
‘>>>’ this symbol is called as prompt and it indicates that user is in interactive mode.
Whenever ‘>>>’ prompt is seen it indicates that interpreter is ready to execute next command.
The main window to IDLE is called as interpreter or shell window.
Steps to interactive mode
Click on Start –> Python 3.4 (any version) –> IDLE(GUI)
EXAMPLE
>>> a=85 #this does not have visible effect so next line again '>>>' will be seen
>>> b='itvoyagers'
>>> a #this statement gives output so '>>>' will not be seen on immediate next line
85
>>> #this indicates interpreter is ready to execute next command
EXAMPLE
>>> x=9
>>> y=6
>>> z=x+y
>>> z
15
NOTE: Assignment operator produces no output in interactive mode
Script Mode
In this mode functions or commands are written in a file which is then saved and executed i.e. they are not executed immediately and will give out result after executing saved file.
In this mode all expressions and statements are stored in a file and saved.This will not show any visible effect until user runs the program and demands result.
Steps to script mode
Click on Start –> Python 3.4 (any version) –> IDLE(GUI) –> Click on File –> New –>write sciprt –>Click File –> Save –> give name to file with extension .py (firstfile.py) –>Click on Run –> Run Module (to execute)
The window in script mode is called as program window.
NOTE:If the file is already saved we can isee keyboard shortcut F5 to Run the script
EXAMPLE
#First Program script.py
x=9
y=6
z=x+y
print(z)
OUTPUT
#this output is displayed after clicking on F5
>>>
15
NOTE: Difference in both modes : print() is used in script mode to give output whereas it is not mandatory in interactive mode.
Interpreter does not understand PRINT command in uppercase and generates error.
Color Coding is helpful in visually categorizing commands and statements.
<strong>Color Coding in Python</strong>
Python Basic Syntax
Any text editor can be used to write a Python script.
We can save python script using .py extension.
We can use command prompt as well as GUI both for executing python script. Indentation plays important role in python scripting.