Best post on IDLE & script mode in Python – 1

What is IDLE?

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.

Color Coding in Python
Color Coding in Python

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.



For other python basics related posts:

Best post on programming language and its types – 1
Python Programming (Basics) – History & Features
Python Programming (Basics)- Debugging & Types of errors
Python Programming (Basics) – Variables, Values, Types & Keywords.
Best post on built-in functions in python – 1
Python Programming (Basics) – Type Conversion
Python Programming (Basics) – Comments,Indentation,Built-in Number Data types and Expressions
Best post on IDLE & script mode in Python – 1
Python Programming (Basics)- Operators in Python
Best post on Order of Operations – Python
Simple and compound statements of python in easy way
Best post on conditional statements in python – Part 1
Best post on conditional statements in python – Part 2
Best post on looping in python (for loop)-Part 1
Best post on looping in python (while loop)-Part 2
Best post on nested loop in python(looping) -Part 3
Best post on infinite loop in python(looping) -Part 4
Best post on control statements(break,continue,pass)-1
Best post on Function definition & calling in python -1
Easy flow of function execution,parameters,arguments-2
Easy fruitful & void function,return values,stack diagrams-3
Best post on types of function arguments in python- 4
Best post on recursive function, scope of variable-5
Best post on import and from statement in python – 1
Best post on modules and built-in modules math,random & time-2
Best post on user defined modules in python-3
Best post on string datatype in python – 1
Best post immutable string,string operations python-2
Best post on string methods in python – 3
Best post on list datatype in python – 1
Best post on mutable list, list operations python – 2
Best post on List methods in python – 3
Best post on dictionary datatype in python – 1
Best post on dictionary methods and operations-2
Best post on tuple datatype in python – 1
Best post on tuple operations and immutable tuple- 2
Best post on tuple methods and built-in functions-3
17 -Python program to demonstrate Button in tkinter and its event in easy way
New posts coming soon.......



For other advanced python related posts:

File Systems and File Handling in Python
Types of file modes and attributes of file object in Python
How to read,write and append in a file in python?
Remaining file methods in Python
File Positions in Python
Directory in Python and its methods
Iterator and Iterables in Python
Exceptions in Python
Exception Handling in Python (Part I)
Exception Handling in Python (Part II)
Regular Expressions
Metacharacters or Regular Expression Patterns
Functions in 're' module(Part I)- Match vs Search
Functions in 're' module(Part II)-findall(), split(), sub()
Flags for regular expressions(Modifiers)
GUI programming in Python and Python GUI Library
What is Tkinter ?
Layout Manager (Geometry Manager) in Python
Events and Bindings in Python along with Widget configuration and styling
Fonts Names, Font Descriptors, System Fonts, Text formatting, Borders, Relief Styles in Python
Best post:Dimensions, Anchors, Bitmaps & Cursors in Python
Canvas widget of tkinter module – Python
Widgets in tkinter module – Python
Label, Text, Entry & Message Widget in Python
Button, Checkbutton & Radiobutton Widget in Python
Best post on Menu and Menubutton Widget of tkinter
Best post- Listbox and Scrollbar(Slider) Widget-Python
Best post on Frame Widget of tkinter in Python
Best post: message box widget and its methods
Best post- LabelFrame, Toplevel, PanedWindow widgets
Best post on Spinbox and Scale Widget in Python
Best post : Database connectivity in Python (Part 1)
Best post : Database Connectivity in Python (Part 2)
Best post on Create and Insert query : Python + MySQL
New posts coming soon.......

Leave a Comment