Page 46 - Information_Practice_Fliipbook_Class11
P. 46
Unit II: Introduction to Python
GETTING STARTED WITH
2 PYTHON PROGRAMMING
Chapter Outline
2.1 Why Python? 2.2 Features of the Python programming language
2.3 Shortcomings of Python 2.4 Downloading and Installing Python
2.5 Using the Python IDLE 2.6 Exiting Python IDE
Introduction
We already know that a computer program is a finite sequence of instructions for a computer to perform a task. A
program may be written in a low-level programming language such as machine language and assembly language or
a high-level programming language such as BASIC, COBOL, C, C++, JAVA, Python. As programs written in high-level
languages are easy to write and comprehend, most programs are written in high-level languages. A program written in
a high-level programming language is called the source code. As a computer only understands binary language—the
language of 0's and 1', the source code must be transformed into a program in the machine language of the computer
(expressed in 0's and 1's) with the help of an interpreter or a compiler. A program in the computer's machine language
is called the object code or binary code.
In the case of a compiled language such as Pascal, C, and C++, the compiler converts an entire program (source code)
into machine language code (object code/ binary code) in one go. The compiler reports all the errors/ warnings to the
programmer. The programmer rectifies the errors and re-compiles the program. If errors still remain, they also need
to be corrected. When the program becomes error-free, the compiler generates the object code that can be executed
to produce the results. On the other hand, in the case of an interpreted language such as Python, Perl, and PHP, the
interpreter processes the source code in small chunks, often one statement at a time, generating the machine code and
executing it. If an error is encountered in a statement, it has to be rectified before the interpreter can proceed further.
In which environments is a compiler preferable over an interpreter and vice versa?
Python is a programming language developed by Guido Van Rossum in 1991 at the National Research Institute
for Mathematics and Computer Science, the Netherlands. Over the years, it has become one of the most popular
programming languages. In this book, we will study Python programming to solve problems. To begin with, in this
chapter, we will learn how to install Python on your desktop.
32 Touchpad Informatics Practices-XI

