4.
GETTING STARTED WITH PYTHON
JINI N K
INTRODUCTION
▪ Python programming language was
developed by Guido Van Rossum in
February 1991
▪ Developed by Python Software
Foundation
NAMING HISTORY
Python was named after
famous BBC comedy show
namely Monty Python’s
Flying Circus
ABOUT PYTHON
▪ Python is based on two programming languages
▪ ABC language
▪ Modula – 3
▪ Python is an easy to learn language
▪ Powerful language
▪ High level programming language
Cross-platform
Easy to use language
Expressive language
Free & Open Source
PYTHON
Integrated language PLUSES
Variety of Applications
Completeness
PYTHON MINUSES
Not the fastest language
Lesser libraries than C, Java, Perl
Not strong on Type-binding
Not easily convertible
How to install Python
• Python can be downloaded from www.python.org
• Available in two versions –
• Python 2.x, Python 3.x
WORKING IN PYTHON
Interactive Mode Script mode
Interactive Mode
• One command at a time
• Python executes the
command immediately
• The interactive
interpreter of Python is
also called Python Shell
Interactive Mode
• Type the command in
Python command
prompt >>>
• Result/Error will be
shown one by one
Script Mode
• Create module/
Script/Program file
• Save all the commands in
the form of program file
• Get complete output
Script Mode
• Create module/
Script/Program file
• Save all the commands in
the form of program file
• Get complete output
To work in Script Mode
Open Python Idle → File → New
Script Mode
Save the Python program/script file with .py extension
Run the Module/ Script/ Program File
Press F5
Output of a module run shown in shell window
Understanding print() statement
print() statement is used to display the output
Syntax: print(<Object/message to be printed>)
Enclose the message/string either in single
quotes or double quotes
Example - print() statement
String enclosed in single quotes
String enclosed in double quotes
String enclosed in triple quotes
Error - print() statement
Error!! Opening and
closing quotation marks do
not match
Comment line - #
• Any line that begins with a # symbol is a comment in Python
• It is for the programmer’s information
Comments
Python will completely ignore all the lines starting with a #
JINI N K