Python - : Dr. M. Ramakrishnan
Python - : Dr. M. Ramakrishnan
Introduction
Dr. M. Ramakrishnan
• Created by Guido Van Rossum at 1991
• Popular Scripting Language
• AI & Data Analysis
• Web Development
• Python works on different platforms
• Windows
Intro • Linux
• Mac
• Simple syntax
• Programmer can achieve the objective with
fewer lines of code
• Interpreter based language
• Python 2
• More existing software package uses this.
• No update will be available.
• Nearing its EOL
Versions • Python 3
• Released on December 2008
• Backward incompatible
• https://www.python.org
/downloads/
• To install packages –
Python pip install
Packagename
Installation
• https://www.anaconda.c
om/products/individual
• Conda install
packagename
Python - • Indentation – Spaces at the beginning of
the code line
features • Python variables are not declared
• Variable is declared when you assign
value for it.
• x = 5 # x is declared as integer
• Y = 5.23 #here Y is declared as float
• Casting
• X = str(3) # X value is ‘3’
• Case Sensitive
• x=5
• X = “John
• Variable name can start with a alphabet
letter and underscore
• A variable name can not start with a number
• A Variable name can contain alpha numeric
characters and underscore
Naming a • Variable names are case sensitive
variable • 2myvar = "John"
my-var = "John"
my var = "John“
• Can assign multiple values to variables in one
line
• X, y = 5, 10
• Print(“x value is” + x)
•
+ for •
x = “IoT is”
Y = “Internet of Things”
Concatenation • Z=x+Y
• Print(Z)
+ Addition
- Subtraction
* Multiplication
Python / Division
Operators % Modulus Operator
Ex: x = 5%2 - Here 5 will be divided by 2
and the reminder (1) will be assigned to x.
• Equals: a == b
• Not Equals: a != b
Relational • Less than: a < b
While loop ….
Loop statement N
Variable manipulation