You are on page 1of 8

Programming language

 A programming language is a computer language that is used by


programmers (developers) to communicate with computers. It is a set of
instructions written in any specific language (C, C++, Java, Python etc) to
perform a specific task.
 A programming language is a vocabulary and set of grammatical rules for
instructing a computer or computing device to perform specific tasks.
Python Language fundamentals
 Introduction
 Application areas of python
 Features of python
 Limitations of python
 Flavors of python
 Python versions
 Identifiers
 Reserved words
 Data types

Prerequisites
 Nothing. Simply need to understand English.

Introduction
 Python is a programming language.
 We can develop applications by using python programming language. Like
Calculator, Gmail etc.
 Python is a high level (programmer friendly) programming language.
 a=1
b=2
c=3 if a<b else 1
Print(c)
Anyone can understand the above code. Hence it’s called high level
(programmer friendly) programming.
a=1
>>> b=2
>>> c=3 if a<b else 1
>>> print (c)
3
>>> c=3 if a>b else 1
>>> print (c)
1
 Python is a general purpose, high level (programmer friendly) programming
language. General purpose means not specific to a particular area. We can
use it in any type of programming language. Like desktop apps, web apps
 Guido van Rossum developed python in 1989 while working in national
research institute, Netherland. Python made available to public in 1991,
officially released into the market in Feb 20th 1991.
 Name got inspired from BBC TV show “The complete Monty python’s
circuses” broadcasted during 1969 to 1974.
 Simple and easy to understand programming language.
 Need to write very less code. (Concise code).

1st Program
 Print your name by using python.
Print (‘your name')
Your name
How to run this script?
1. Save the script in .py format.
2. The execute python name.py or py name.py

 Print sum of two numbers by using python.


>>> a=2
>>> b=3
>>> print (‘the sum of a & b =', a+b)
('The sum of a & b =', 5)
>>> print 'the sum of a & b =', a+b
The sum of a & b = 5

a,b,c=1,2,3
>>> print 'The sum of a,b&c =',a+b+c
The sum of a,b&c = 6
Use of Python
As it’s a general purpose prog Lang,
 To develop desktop applications(apps which are running in a single system
called as standalone apps) e.g.- calculator
 Web apps like Gmail, e commerce apps etc.
 Network apps(Client server apps)
 Game development
 Data analysis
 ML,DL,AI
Leading companies like YouTube, facebook, yahoo, Google, dropbox, Netflix,
instagram, spotify, Quora, NASA etc are using python.

Features of python
1. Simple and easy to learn
2. Freeware and open source
3. High level prog lang
4. Platform independent
5. Portability
6. Dynamically typed
7. Both procedure oriented and object oriented
8. Interpreted
9. Extensible
10. Embedded
11. Extensive Library etc.

Simple and easy to learn


 English is having n numbers of words but python having only 33 reserved
words.
 X=(7>6)?1:2; (Other Language)
X=1 if 7>6 else 2 (Python)
 Assume one file is there book.txt having some data. So now write a python
file to read data from book.txt and print it.
print (open (‘book.txt’).read())
Freeware and open source
 We are not required to pay anything to use python. (Non Profitable Org.)
 One charitable organization/foundation is there called PSF- Python
Software Foundation to take the responsibilities & maintenances of Python.
 python.org is the official website.
 The source code of python is open to everyone.
 If I feel that python source code is not fulfilling my requirements then I will
customize that source code & will use the customized version of python
source code as imis python.
 If we want to work with java app we required Jython.
 Similarly for c sharp .net apps we required Iron Python.
 For big data (large amount of data) Anaconda python is there.

High level programming language


 Python is a high level programming language means programmer friendly
programming language. Any programmer can easily read, understand &
write the python code.
 Let’s consider
a=22
b=56
print (a*b)
Anyone can understand the above program easily. Means it is Programmer
friendly high level Programming Language.
 As it is a high level language, we shouldn’t consider the low level activities
like memory allocation, object destruction, security, free spaces etc.
Because internally Python Virtual Machine (PVM) is going to take care of all
activities.

Platform independent
 Python is a cross-platform programming language, which means that it can
run on multiple platforms like Windows, macOS, Linux etc. They can be run
on different platforms using an interpreter built specifically for that
platform.
 Having a python program to run with windows, Linux & Mac OS, Python
Virtual Machine (PVM) for windows, PVM for Linux & PVM for Mac will be
required.
 As we are seeing that one python program is running in three different
platforms. (Write once & run anywhere)
 Python program is platform independent but PVM is platform dependent.

Portability
 Without performing any changes or with minimal changes in our existing
application we can migrate our python programs from one platform to
another platform, which is called portability nature of python.

Dynamically typed
 In python we are not required to declare type explicitly. Based on our
provided value automatically the type will be considered. This nature is
considered as dynamically typed programming language.
 a=44
print (type (a))
<class int>
 Whenever we are assigning values, based on our provided value type will
be considered automatically. Such type of programming language is called
as dynamically typed programming language.
>>> a=5
>>> type(a)
<type 'int'>
>>> a=10.7
>>> type(a)
<type 'float'>
>>> a='rain'
>>> type(a)
<type 'str'>
>>> a=True
>>> type(a)
<type 'bool'>

Both procedure oriented and object oriented


 Based on our requirement we can use python as procedure oriented, object
oriented, scripting programming language etc.
1. C=functional programming language (Define a fun, write code inside
the fun & call)
Def f1():
print ‘python’
print ‘python’
print ‘python’
f1()
2. C++, java= object oriented programming language (Write a class,
within a class define method, create an object, then call that method
related to that class)
class Test:
def m1(self):
print('python')
print('python')
t=Test()
t.m1()
3. Perl, shell scripting= scripting programming language (Group of lines
will get executed 1 by 1)
print 'python'
print ‘python’
print ‘python’
4. Modula3= modular programming language
Python is having all the above characteristics.

Interpreted
 Other programming languages are first need to compile and then run but in
case of python directly we are running it. Internally interpreter will
responsible for compiling.

Extensible
 We can extend the functionality of python application with other languages
application.
 We can use other language code inside our python applications.
 Performances of the application will be improved.
Embedded
 Extensible in reverse.
 We can use python code in any other languages application.

Extensive Library
 In python for every requirement readymade library is available. (Huge
libraries are available). No other programming language has this much
library support.
 As a programmer we can use these libraries directly without implementing
functionalities.
 Because of these rich libraries we can write python code very easily with
concise code.
 E.g. write a python program to generate six digit otp.
To generate random numbers already a library is available called random
which contain randint function. randint (0,9)
from random import randint
for i in range(10):
print (randint(0,9), randint(0,9), randint(0,9), randint(0,9),
randint(0,9), randint(0,9),sep=’’)
2 5 3 7 5 6
123456

Limitations of python
 Python is not having the library support to develop mobile applications till
now.
 Not the best choice for Enterprise applications like banking applications,
telecom applications etc.(Transaction management, security, massaging
services like libraries are not available with python)
 Performance is low as it’s an interpreted language in nature.JIT compiler
concept is added to PVM to enhance the performance of python as it is
interpreting a group of lines only once and the interpreted code is going to
be used directly, which is available in pypy version also known as python for
speed.
Flavors of python
 Python is freeware and open source.
Customized versions of python are-
 Cpython (Suitable to work with C language applications)
 Jython or Jpython (Suitable to work with java applications) JVM can run
Jython code.
 Iron Python (To work with C# .Net application)
 Ruby Python (To work with ruby)
 Anaconda python (DS,ML,DL,AI) Because it contains several libraries like
pandas, numpy, Jupiter ide etc which are suitable for DS,ML,DL,AI etc.(To
work with large volume of data)
 Stackless (python for concurrency, To develop concurrent applications)
 Pypy (python for speed) JIT-Just in time compiler + PVM

Python versions
 Python 0.9.0 (feb 20th 1991)
 Python 1.0 (Jan 1994)
 Python 2.0 (oct 16th 2000) Known as py2k
 Python 3.0 (dec 3rd 2008) Known as py3k
 Python 0.9.0

You might also like