Python
Introduction
While learning
something new, we normally have many questions like what , why, when and how ,
in our mind. So let's begin our Learning of Python Language with getting
answers to them first before enjoying the Learning.
What
is Python?
Python is a
popular computer programming language. It was developed by Guido van Rossum,
and released in 1991. Python is developed under an OSI-approved open source
license, making it freely usable and distributable, even for commercial use. Python
1 was released in the year 1994. But major usages started only after year 2000
when python 2 was released. The last release of Python 2 was Python 2.7, released
in the year 2010 and was stopped for further improvement only by 2020. The Language
is still in evolving process mode only. The most recent major version is Python
3 (from DEC 2008 ), Current Version and release is 3.10, released as late as
2021 October and in 2022 October , 3.11 is expected for release and 2023 it is
going to be 3.12.
One of the main
reasons for the popularity of python would be its simplicity in syntax so that
it could be easily read and understood even by amateur developer also.
What
is it used for?
It is a
Multipurpose language and can be used in development of variety of
Applications, few popular Applications are
] Web Application development (server-side)
] Networking Applications
] Application Software development
] Mathematics
] System Scripting
] Image Processing
Why
is Python becoming Popular?
While the
Language is still in evolving mode, we find Python being used in several major
Applications and the main reasons behind that are
F It can work on different platforms (Windows
,Mac, Linux, Raspberry Pi,etc.)
F It has a simple syntax similar to the
English language
F It has syntax that allows developers to
write programs with fewer lines than some other programming languages.
F It runs on an interpreter system, meaning
that code can be executed as soon as it is written. This means that prototyping
can be very quick.
F It can be treated in a procedural way, an
object-oriented way or a functional way.
How
to use Python?
Basic
requirement to RUN a python Program we require the Python Software to be
installed in our system. Since the Software is open source License any one can
download from our Web and Install in our system.
The software to
be downloaded for Installation depends upon the Operating System being used and
also the Architecture whether it is 32 bit or 62 bit one. In this book, we are
going to follow the PYTHON 3.7 version, because it is Last Release that will
work on Windows 7 Platform. (Since even now many are using Windows 7 , though
officially it is discontinued by Microsoft, Let's take this as our Base) . If
required you can Download Python 3.8 or 3.9 or 3.10 also.
On Installation
of Python in our System, we can easily Develop Programs in Python and run them.
There are
several ways to develop a python program and run it. The simplest way is type
the program in Notepad or any Editor available in the OS, save the program with
the file extension as py and Run it.
To Run a Python
Program we have to open the command Window (Click Windows button in Run a
application type cmd and press enter ,this will open the command Window which
is in DOS mode.)
Using cd
(Change Directory) command go to the location
of your folder where the Python program has been saved and type.
py
<filename.py>
This will start
the Python Interpreter and run the Program, if there is any Error it will
display that too.
It is also
possible to write a Python program in an Intergrated Development Environment
(IDE), such as Thonny, Pycharm, Netbeans , Atom , Sublime Text, Eclipse etc.,
which are particularly useful when managing larger collections of Python files.
This requires separate installations of the software. The Default IDE that
comes with Python Software is name IDLE (Integrated Development and Learning
Environment), this is available in the Folder where the Python Software is
Installed in the System. IDLE can be used in 2 ways one as Python Shell Window
or as Python Edit Window. The Default setup is Shell window where you can
directly execute and Python statements. To change it to Edit Window, go to
shell window screen from the options menu select configure IDLE menu and in the
displayed TABS, select window Tab and set at startup as open edit window option
instead of open shell window and click ok, close the shell window and restart
the IDLE application.
In Edit window
we have the option of RUN menu where after saving a Python file we can Run it using
Run Module menu or using the shortcut key F5, for the same.
Python Syntax Compared to other Programming Language
Python was designed for readability , and has some similarities to the
English language with influence from mathematics.
Python uses new lines to complete a command , as opposed to other
programming languages which often use semicolons or parentheses as end of Line
or Blocks.
Python relies on indentation or using whitespace , to define scope or
block; such as the scope of control statements, Functions and classes. Either
use Tab key or 4 Spaces uniformly for indentation purpose. Once a statement
block completes reverse to the older indentation. Thus the python Interpreter
will understand the above statements form a Block of Statements. Other
programming languages often use curly brackets for this purpose.
Declaration of variables or Function are not required in python, while
in other languages it is mandatory.
Python Language does not require any start point and End point unlike
other Languages. The program can be a single line or of pages together. Each
statement is Interpreted and executed.
Example of a Python Program
print("Welcome to the World of Python!!!")
This will display the statement enclosed in quotation as such. Now let's
discuss about Python Language in detail.
No comments:
Post a Comment