OF
INFORMATIC PRACTICES
CLASS XI
UNIT-Introduction to Python Part-1
What is Python
It is programming language developed by Guido
Van Rossum in Feb. 1991.
It is easy to Learn and powerful object oriented
Progamming Language
Pluses(Advantages of
Python)
Easy to Use
Expressive Language
Interpreted Language
Its Completeness(all the required libraries are included at
the time of installation)
Cross Platform Language
Free and Open Source
Variety of Applications like –scripting, web applications,
game development, system administrations, rapid
prototyping, GUI Programs, Database Applications
Minuses of Python
Not the fastest Language
Lesser Libraries than C, JAVA, Perl
Not Strong on Type- Binding
Runtime Errors
Interactive Mode Script Mode
Commands are executed directly at the prompt
Examples :-
>>> print 5+8
13
>>>6+10
16
>>>Print “Welcome to the world of Python”
Welcome to the world of Python
>>> (10+5)/3
5
Interactive Mode : Sequence of commands
Example 1 Example 2
>>> x=10 >>> a=10
>>>y=40 >>>a+1 , a-1
>>>Z=x+y (11,9)
>>>print Z
50
to repeat the prior command in the
interactive window , use to scroll
backward through the command history
and key to scroll forward.
To leave the interpreter and
return to shell
•^D (Ctrl+D) or
•Type quit ()
Advantages of Interactive
Mode
Helpful when your script is extremely short and you
want immediate results.
Faster as you only have to type a command and then
press the enter key to get the results.
Good for beginners who need to understand Python
basics.
Disadvantages of
Interactive Mode
Editing the code in interactive mode is hard as you
have to move back to the previous commands or else
you have to rewrite the whole command again.
It's very tedious to run long pieces of code.
Script Mode
File New
Type Python program in a file
Save it . Default extension is .py
then use interpreter to execute the
contents from the file by
Can use Run option or press F5
type the function name at command
prompt
Script Mode
Advantages of Script Mode
It is easy to run large pieces of code.
Editing your script is easier in script mode.
Good for both beginners and experts.