Introduction to Python Programming
History of python programming Language
Python was conceived in the late 1980s and its implementation was started
in December 1989 by Guido van Rossum
Rossum choosen the name ashe is the big fan of popular BBC comedy TV
show called
“Monty Python’s Flying Circus” he needed a name that was short, unique,
and slightly mysterious, so he decided to call the language “Python”
First public release python-FEB-1991
Official website –www.python.org.-b/w 1996 and 1997
Python Software Foundation-2001
Van Rossum is principle author of python
For his continuing central role in python development is “Benevolent
Director of Life Now”
It is a title given to small number of open source software development
leaders
Python is ranked at first position by IEEE Spectrum ranking of
Top programming languages for the year 2017
Why python?
It is a Beginner friendly
Easy to understand
It is a high level language
It is a portable language
Features of PYTHON
Python is High Level Programming Language
The programming will be like writing English sentences.
It supports Multiple Programming Paradigms
Like Imperative,procedural , Functional, Object-Oriented
Imperative programming: In the kind of programming, we need to specify
what is requires and we need to specify how to accomplish it.
Ex: C language, Java,.Net, Python
Procedural programming refers to the ability to combine a sequence of
instructions into a procedure so that these instructions can be invoked from
many places without resorting to duplicating the same instructions
FORTRAN,COBOL
Functional programming languages:- The program is divided into several
functions
The data is shared among several functions
Concentrates more on functions
you can pass a function as an argument to another function, or a function
may
return another function. Examples of functional programming languages are
F#, LISP,
Object oriented programming languages
Emphasizes more on data
They treat data as critical element for program development
The data and methods that operate on data are encapsulated in single data
structure called object
Object object communication takes place for the smooth running of
software
Interpreted: It is called as Interpreted language because the execution will
be done by an interpreter and the code will also be checked by interpreter.
As compiler oriented programming languages run faster because
compilation is done before execution
On other hand interpreted language run slower because compilation and
execution done simultaneously
but incase python even though it is interpreted but incase python even
though it is interpreted but it runs faster
Dynamically Typed: python is a dynamically typed language which means
that the type of the value will be decided at runtime and therefore we need
not specify the type.
Cross platformed :- python is Independent of platform
python programs can be executed on any platform
we can run our python code on windows,linux,MAC any another
Open Source : It is open source language i.e. it is free
Interactive : It provides interactive mode for learning the language
Memory Management : here, the language itself will take care of both
allocation and de allocation of memory
Portable: the python language programs are portable i.e. we get the same
output irrespective of where it is executed.
Huge Standard Library : the python has a large library which can be ued
for rapid application development(RAD)
Imported: we can execute other language programs in python language
Extensible : The python language programs can be executed in other
programming languages
GUI support: using python language we can develop GUI
Python focuses on faster development time
Python code has very natural style which makes code easy to
read,write,understand
no need place ;,{ } all these things saves our time
Applications of Python
Desktop Applications
- Mobile Applications
- Embedded Applications
- Web Based Applications
- Games
- Scripting
- Machine learning
- Data Analysis / Visualization
File Extensions in Python
.py –The normal extension for a Python source file
.pyc- The compiled bytecode
.pyd- A Windows DLL file
.pyo- A file created with optimizations
.pyw- A Python script for Windows
.pyz- A Python script archive
Installation Python
We can download python latest software
From www.python.org
We can download latest version of python
Python 3.9.0
Release Date: Oct. 5, 2020
Default 64bit installer not supported window7 os
Python Interpreter and Interactive mode
The Python Interpreter:-A program that can read Python programming
statements and execute them is the Python interpreter
Python interpreter has two modes:–
Interactivemode waits for a statement from the keyboard and
executes it–
Scriptmode reads the contents of a file (Python program or Python
script) and interprets each statement in the file
Interpreter Mode•Invoke Python interpreter through Windows or command
line
>>>is the prompt that indicates the interpreter is waiting for a Python
statement
>>> print (‘Python programming is fun!’) [ENTER]
Python programming is fun!
(>>>) chevron:-
In the interactive mode the chevron is a prompt used by the interpreter to
indicate that it is ready.
Note:-Statements typed in interactive mode are not saved as a program
Scriptmode:-
The IDLE Programming Environment
Integrated DeveLopment Environment (IDLE)
–Automatically installed when Python language is installed–
It has a built-in text editor–
IDLE editor colorizes code
Writing Python Programs and Running Them in Script Mode
Use a text editor to create a file containing the Python statements
Save the file with a .py extension•
To run from windows cmd
C:\pythonproj>python Hello1.py
Helloworld
To run from IDLE select run option à select run module option
You can see the out put