SlideShare a Scribd company logo
1 of 54
Python
Introduction
CREATED BY RIDA ZAMAN 1
Python
• High Level Programming Language for general
purpose programming
( general-purpose programming language is a
programming language designed to be used for
writing software in a wide variety of application
domains)
• Created by Guido Van Rossum
• Release in 1991
• Interpreted not Compiled
• Open Source
CREATED BY RIDA ZAMAN 2
Why Python?
CREATED BY RIDA ZAMAN 3
Advantages
● Easy to Learn
● Simple Syntax
● Write Less. Do More.
● Code Readability
● Versatile and Flexible
CREATED BY RIDA ZAMAN 4
Possibilities
● Machine Learning
● Computer Vision
● Web Development
● Game Development
● Web Scraping
● Desktop Applications
CREATED BY RIDA ZAMAN 5
Machine Learning
● Chat bots
● Speech Recognition
● Anti Virus
● Cancer Detection
CREATED BY RIDA ZAMAN 6
Computer Vision
● Self Driving Cars
● Image Recognition
● Gesture Recognition
● Robots
● Image Enhancement
CREATED BY RIDA ZAMAN 7
Web Development
● Instagram
● Youtube
● Pinterest
CREATED BY RIDA ZAMAN 8
Game Development
CREATED BY RIDA ZAMAN 9
Web Scraping
● News Scraping
● Price Comparison
● Reviews
● Monitoring
CREATED BY RIDA ZAMAN 10
To grab or capture the textual information
In a particular file format through a third
party software without opening the web
Page in a web browser
Desktop Application
CREATED BY RIDA ZAMAN 11
CREATED BY RIDA ZAMAN 12
SCOPE
Job Trends
CREATED BY RIDA ZAMAN 13
Popularity
CREATED BY RIDA ZAMAN 14
INSTALLATION
CREATED BY RIDA ZAMAN 15
Installation
www.python.org
CREATED BY RIDA ZAMAN 16
IDE’s for Python
• Idle
• Atom
• Editra
• PyCharm
• Gedit
• PythonWin
• Spyder
CREATED BY RIDA ZAMAN 17
CODING
(SIMPLE PROGRAMS)
CREATED BY RIDA ZAMAN 18
Basic syntax of a python program is
too simple than other languages:
Python:
>>> print(“Hello World
!”)
Java:
public class HelloWorld
{
public static void
main(String[] args)
{
System.out.println("Hell
o, World");
}
}
C :
#include<stdio.h>
void main()
{
printf(“Hello World !”);
}
CREATED BY RIDA ZAMAN 19
Read User Input from Keyboard in
Python:
>>> # Python Basic Syntax - Example Program
>>> strn = input("Enter your name: ")
>>> print("Your name is ", strn);
CREATED BY RIDA ZAMAN 20
Comments:
• Single line comment
• All characters after hash (#) sign referred as
comment (single line comment), up to the
physical line end.
• Example:
# Python Basic Syntax - Example Program
# We are comments
print("Hello World, I am Python");
CREATED BY RIDA ZAMAN 21
Multiline Comments:
• multiline comments are used inside triple
quotes.Multiline starting commenting code is
''' and ending with same, that is ''‘.
• Example:
''' this
Is
Multiline comment ''‘
Print(“ Hello Python, n This is multiline comment”)
CREATED BY RIDA ZAMAN 22
Delete keyword:
• To delete the variable in python, use the keyword
del.
• Example:
num1 = 10
num2 = 20
print("num1 = ", num1, " and num2 = ", num2);
del num1, num2
print("num1 = ", num1, " and num2 = ", num2);
CREATED BY RIDA ZAMAN 23
Strings:
• Strings are contiguous set of characters in
between quotation marks. You are free to use
either pairs of single or double quotes to use
the strings in your python program.
• Example:
str1 = 'Hello Python‘
str2 = "This is Python Strings Example"
CREATED BY RIDA ZAMAN 24
Concept and use of string in python:
# Python String - Example
str = 'Hello Python’
1- print (str) # this will print the complete string
2- print (str[0]) # this will print the first character of
the string
3- print (str[2:8]) # this will print the characters starting
from 3rd to 8th
4- print (str[3:]) # this will print the string starting from
the 4th character
5- print (str * 3) # this will print the string three times
6- print (str + "String") # this will print the concatenated
string
7- Print (len(str)) # this will print the length of string
CREATED BY RIDA ZAMAN 25
Operators:
• Arithmetic Operators
• Comparison (Relational) Operators
• Logical Operators
• Assignment Operators
• Bitwise Operators
• Membership Operators
• Identity Operators
CREATED BY RIDA ZAMAN 26
Operator Name Meaning
+ Addition Operator Add two values
- Subtraction Operator Used for subtraction
* Multiplication Operator Used for multiplication
/ Division Operator Used for division
% Modulus Operator
Returns remainder after
dividing
// Floor Division Operator
Returns the quotient
without any digits after
decimal
** Exponent Operator
Used to perform
exponential calculation
on operators
CREATED BY RIDA ZAMAN 27
Python Arithmetic Operators
Here the following table lists the arithmetic operators (7) available in
python with their name and meaning:
# Python Operators - Python Arithmetic Operators - Example Program
num1 = 23
num2 = 10
print("If num1 = 23 and num2 = 10. Then,");
res = num1 + num2
print("num1 + num2 = ", res)
res = num1 - num2
print("num1 - num2 = ", res)
res = num1 * num2
print("num1 * num2 = ", res)
res = num1 / num2
print("num1 / num2 = ", res)
res = num1 % num2
print("num1 % num2 = ", res)
#changing the values of num1 and num2
num1 = 2
num2 = 3
print("nIf num1 = 2 and num2 = 3. Then,");
res = num1 ** num2
print("num1 ** num2 = ", res)
#again changing the values of num1 and num2
num1 = 10
num2 = 5
print("nIf num1 = 10 and num2 = 5. Then,");
res = num1 // num2
print("num1 // num2 = ", res)
CREATED BY RIDA ZAMAN 28
Python Comparison Operators:
Operator Meaning
==
Returns true if values of the two operands are equal,
otherwise returns false if not equal
!=
Returns true if value of the two operands are not
equal, otherwise returns false if equal
>
Returns true if value of the left operand is greater
than right one, otherwise false if value of the right
operand is greater than left one
<
Returns true if value of the left operand is less than
right one, otherwise false if value of the right operand
is less than left one
>=
Returns true if value of the left operand is greater
than or equal to the value of the right one, otherwise
false if value of the right operand is greater than left
one
<=
Returns true if value of the left operand is
less than or equal to right one, otherwise
false if value of the right operand is less
than or equal to left one
CREATED BY RIDA ZAMAN 29
Here the following lists the comparison operators (6) available in Python:
# Python Operators - Comparison Operators -
Example Program
num1 = 23
num2 = 10
print("If num1 = 23 and num2 = 10. Then,");
if(num1 == num2):
print("num1 is equal to num2");
elif(num1 != num2):
print("num1 is not equal to num2");
elif(num1 < num2):
print("num1 is less than num2");
elif(num1 > num2):
print("num1 is greater than num2");
elif(num1 <= num2):
print("num1 is either less than or equal to num2");
elif(num1 >= num2):
print("num1 is either greater than or equal to
num2");
# changing the values of num1 and num2
num1 = 40
num2 = 40
print("n If num1 = 40 and num2 = 40. Then,");
if(num1 <= num2):
print("num1 is either less than or equal to num2");
else:
print("num1 is neither less than or equal to
num2");
if(num1 >= num2):
print("num1 is either greater than or equal to
num2");
else:
print("num1 is neither greater than or equal to
num2"); CREATED BY RIDA ZAMAN 30
Python Assignment Operators:
Assume variable a holds 30 and variable b
holds 18, and c is a variable.
CREATED BY RIDA ZAMAN 31
CON’T:
CREATED BY RIDA ZAMAN 32
EXAMPLE CODE:
a,b=30,18
print('a=',a)
print('b=',b) c=a+b
print('c=a+b=',c)
c+=a #c=c+a c=48+30=78 now c is 78
print('c=c+a=',c)
c-=a #c=c-a c=78-30=48 now c is 48
print('c=c-a=',c)
c*=a #c=c*a c=48*30=1440 now c is 1440
print('c=c*a=',c)
c/=a #c=c/a c=1440/30=48 now c is 48
CREATED BY RIDA ZAMAN 33
CON’T:
print('c=c/a=',c)
c%=a #c=c%a c=48%30=18 now c is 18
print('c=c%a=',c)
c**=a #c=c**a
c=18^30=4.551715960790334e+37 now c is
4.551715960790334e+37
print('c=c^a=',c)
c//=a #c=c//a
c=4.551715960790334e+37//30=1.517238653596778e+3
6 now c is 1.517238653596778e+36
print('c=c//a‘,c)
CREATED BY RIDA ZAMAN 34
RESULT:
a= 30
b= 18
c=a+b= 48
c=c+a= 78
c=c-a= 48
c=c*a= 1440
c=c/a= 48.0
c=c%a= 18.0
c=c^a= 4.551715960790334e+37
c=c//a 1.517238653596778e+36
CREATED BY RIDA ZAMAN 35
Python Bitwise Operators :
Bitwise operator works on bits and performs bit
by bit operation.
CREATED BY RIDA ZAMAN 36
CON’T:
CREATED BY RIDA ZAMAN 37
CON’T:
Assume if a = 60; and b = 13; Now in binary format they will be as follows
a=0011 1100
b=0000 1101
|
Binary OR
a | b Does a "bitwise or". Each bit of the output is 0 if the corresponding
bit of a AND of b is 0, otherwise it's 1.
CREATED BY RIDA ZAMAN 38
CON’T:
a & b Does a "bitwise and". Each bit of the
output is 1 if the corresponding bit of a AND
of b is 1, otherwise it's 0.
CREATED BY RIDA ZAMAN 39
CON’T:
^
Binary XOR
x ^ y Does a "bitwise exclusive or". Each bit of the output
is the same as the corresponding bit in x if that bit in y
is 0, and it's the complement of the bit in x if that bit in
y is 1.
CREATED BY RIDA ZAMAN 40
CON’T:
~
Binary Ones Complement
~ a Returns the complement of x - the number you get by switching
each 1 for a 0 and each 0 for a 1. This is the same as -a - 1.
CREATED BY RIDA ZAMAN 41
CON’T:
<<
Binary Left Shift
a << 2 Returns a with the bits shifted to the left by 2
places (and new bits on the right-handside are zeros).
a<<2 0 0 1 1 1 1 0 0<<2 1 1 1 1 0 0 0 0 240
>>
Binary Right Shift
a >> 2 Returns a with the bits shifted to the right by 2
places (and new bits on the left-hand side are zeros).
a>>2 0 0 1 1 1 1 0 0>> 0 0 0 0 1 1 1 1 15
CREATED BY RIDA ZAMAN 42
CON’T:
CREATED BY RIDA ZAMAN 43
EXAMPLE CODE
a=0b00111100 b=0b00001101 print('a=',bin(a),'b=',bin(b))
print('a or b is=',bin(a|b))
print('a and b is=',bin(a&b))
print('a xor b is=',bin(a^b))
print('Ones Complement of a=',bin(~a))
print('a Left Shift by 2 is',bin(a<<2))
print('a Right Shift by 2 is',bin(a>>2))
RESULT
a= 0b111100 b= 0b1101
a or b is= 0b111101
a and b is= 0b1100
a xor b is= 0b110001
Ones Complement of a= -0b111101
a Left Shift by 2 is 0b11110000
a Right Shift by 2 is 0b1111
CREATED BY RIDA ZAMAN 44
Python Logical Operators
here are following logical operators supported
by Python language. Assume variable a holds
10 and variable b holds 20 then
CREATED BY RIDA ZAMAN 45
EXAMPLE CODE
a,b=10,20
c=c=(a>11)and (b>10) # 0 and 1 so result is false
print(c)
c=(a>11)or(b>10) # 0 or 1 so result is true print(c)
a,b=10,20
c=not((a>11)and (b>10)) # not(0 and 1)=not(false) so
result is true
print(c)
RESULT
False
True
True
CREATED BY RIDA ZAMAN 46
Python Membership Operators
Python’s membership operators test for
membership in a sequence, such as strings, lists,
or tuples. There are two membership operators
as explained below.
CREATED BY RIDA ZAMAN 47
Python Logical Operators
here are following logical operators supported
by Python language. Assume variable a holds
10 and variable b holds 20 then
CREATED BY RIDA ZAMAN 48
EXAMPLE CODE
a=[1,2,3,4,5,6,7,8,9,10] # a is a list
print(3 in a) # 3 in list a so result is true
print(20 in a) # 20 not in list a so result is false
print(3 not in a) # 3 not in list a ,(but 3 in list a) so result is false
print(20 not in a) # 20 not in list a ,(but 20 not in list a ) so result is
true
RESULT
True
False
False
True
CREATED BY RIDA ZAMAN 49
Python Identity Operators
Identity operators compare the memory locations
of two objects. There are two Identity operators
as explained below.
CREATED BY RIDA ZAMAN 50
EXAMPLE CODE
a,b=10,100
print(a is b)
print(a is not b)
RESULT
False
True
CREATED BY RIDA ZAMAN 51
Variables :
Python is dynamically typed. You do not need to
declare variables!
The declaration happens automatically when you
assign a value to a variable.
CREATED BY RIDA ZAMAN 52
Variables can change type, simply by assigning
them a new value of a different type.
CON’T:
Python allows you to assign a single value to
several variables simultaneously.
CREATED BY RIDA ZAMAN 53
You can also assign multiple objects to
multiple variables.
THE END
SUBMITTED BY:
RIDA ZAMAN
RIDA FATIMA
SADAF REASHEED
CREATED BY RIDA ZAMAN 54

More Related Content

What's hot

Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 2
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 2Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 2
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 2Philip Schwarz
 
From Scala Monadic Effects to Unison Algebraic Effects
From Scala Monadic Effects to Unison Algebraic EffectsFrom Scala Monadic Effects to Unison Algebraic Effects
From Scala Monadic Effects to Unison Algebraic EffectsPhilip Schwarz
 
Transition graph using free monads and existentials
Transition graph using free monads and existentialsTransition graph using free monads and existentials
Transition graph using free monads and existentialsAlexander Granin
 
03. Operators Expressions and statements
03. Operators Expressions and statements03. Operators Expressions and statements
03. Operators Expressions and statementsIntro C# Book
 
Gentle introduction to modern C++
Gentle introduction to modern C++Gentle introduction to modern C++
Gentle introduction to modern C++Mihai Todor
 
Triton and Symbolic execution on GDB@DEF CON China
Triton and Symbolic execution on GDB@DEF CON ChinaTriton and Symbolic execution on GDB@DEF CON China
Triton and Symbolic execution on GDB@DEF CON ChinaWei-Bo Chen
 
Stack_Application_Infix_Prefix.pptx
Stack_Application_Infix_Prefix.pptxStack_Application_Infix_Prefix.pptx
Stack_Application_Infix_Prefix.pptxsandeep54552
 

What's hot (17)

Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 2
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 2Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 2
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 2
 
Functions
FunctionsFunctions
Functions
 
From Scala Monadic Effects to Unison Algebraic Effects
From Scala Monadic Effects to Unison Algebraic EffectsFrom Scala Monadic Effects to Unison Algebraic Effects
From Scala Monadic Effects to Unison Algebraic Effects
 
Cpp Homework Help
Cpp Homework Help Cpp Homework Help
Cpp Homework Help
 
Transition graph using free monads and existentials
Transition graph using free monads and existentialsTransition graph using free monads and existentials
Transition graph using free monads and existentials
 
C-Language Unit-2
C-Language Unit-2C-Language Unit-2
C-Language Unit-2
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
C Language Unit-1
C Language Unit-1C Language Unit-1
C Language Unit-1
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Stacks
StacksStacks
Stacks
 
03. Operators Expressions and statements
03. Operators Expressions and statements03. Operators Expressions and statements
03. Operators Expressions and statements
 
Stack of Data structure
Stack of Data structureStack of Data structure
Stack of Data structure
 
05 queues
05 queues05 queues
05 queues
 
Gentle introduction to modern C++
Gentle introduction to modern C++Gentle introduction to modern C++
Gentle introduction to modern C++
 
Triton and Symbolic execution on GDB@DEF CON China
Triton and Symbolic execution on GDB@DEF CON ChinaTriton and Symbolic execution on GDB@DEF CON China
Triton and Symbolic execution on GDB@DEF CON China
 
Vb.net ii
Vb.net iiVb.net ii
Vb.net ii
 
Stack_Application_Infix_Prefix.pptx
Stack_Application_Infix_Prefix.pptxStack_Application_Infix_Prefix.pptx
Stack_Application_Infix_Prefix.pptx
 

Similar to PYTHON

Python Programming - IX. On Randomness
Python Programming - IX. On RandomnessPython Programming - IX. On Randomness
Python Programming - IX. On RandomnessRanel Padon
 
functions2-200924082810.pdf
functions2-200924082810.pdffunctions2-200924082810.pdf
functions2-200924082810.pdfpaijitk
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]vikram mahendra
 
Programming python quick intro for schools
Programming python quick intro for schoolsProgramming python quick intro for schools
Programming python quick intro for schoolsDan Bowen
 
Introduction to golang
Introduction to golangIntroduction to golang
Introduction to golangwww.ixxo.io
 
FUNDAMENTALS OF PYTHON LANGUAGE
 FUNDAMENTALS OF PYTHON LANGUAGE  FUNDAMENTALS OF PYTHON LANGUAGE
FUNDAMENTALS OF PYTHON LANGUAGE Saraswathi Murugan
 
Python programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - KalamasseryPython programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - KalamasserySHAMJITH KM
 
Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Fariz Darari
 
PE1 Module 2.ppt
PE1 Module 2.pptPE1 Module 2.ppt
PE1 Module 2.pptbalewayalew
 
Python lambda functions with filter, map & reduce function
Python lambda functions with filter, map & reduce functionPython lambda functions with filter, map & reduce function
Python lambda functions with filter, map & reduce functionARVIND PANDE
 
Basic Concepts in Python
Basic Concepts in PythonBasic Concepts in Python
Basic Concepts in PythonSumit Satam
 
Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105NUST Stuff
 

Similar to PYTHON (20)

C++
C++C++
C++
 
Python Programming - IX. On Randomness
Python Programming - IX. On RandomnessPython Programming - IX. On Randomness
Python Programming - IX. On Randomness
 
functions2-200924082810.pdf
functions2-200924082810.pdffunctions2-200924082810.pdf
functions2-200924082810.pdf
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
 
Programming python quick intro for schools
Programming python quick intro for schoolsProgramming python quick intro for schools
Programming python quick intro for schools
 
Python in details
Python in detailsPython in details
Python in details
 
3. basics of python
3. basics of python3. basics of python
3. basics of python
 
Operators
OperatorsOperators
Operators
 
Introduction to golang
Introduction to golangIntroduction to golang
Introduction to golang
 
Pythonppt28 11-18
Pythonppt28 11-18Pythonppt28 11-18
Pythonppt28 11-18
 
FUNDAMENTALS OF PYTHON LANGUAGE
 FUNDAMENTALS OF PYTHON LANGUAGE  FUNDAMENTALS OF PYTHON LANGUAGE
FUNDAMENTALS OF PYTHON LANGUAGE
 
Basic commands in C++
Basic commands in C++Basic commands in C++
Basic commands in C++
 
Python programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - KalamasseryPython programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - Kalamassery
 
Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02
 
PE1 Module 2.ppt
PE1 Module 2.pptPE1 Module 2.ppt
PE1 Module 2.ppt
 
Python lambda functions with filter, map & reduce function
Python lambda functions with filter, map & reduce functionPython lambda functions with filter, map & reduce function
Python lambda functions with filter, map & reduce function
 
lecture 2.pptx
lecture 2.pptxlecture 2.pptx
lecture 2.pptx
 
Basic Concepts in Python
Basic Concepts in PythonBasic Concepts in Python
Basic Concepts in Python
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
 
Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105
 

More from RidaZaman1

Overview of the Subject of Human Resource Management
Overview of the Subject of Human Resource ManagementOverview of the Subject of Human Resource Management
Overview of the Subject of Human Resource ManagementRidaZaman1
 
career management.pptx
career management.pptxcareer management.pptx
career management.pptxRidaZaman1
 
Computer Networks
Computer NetworksComputer Networks
Computer NetworksRidaZaman1
 
Restricting the recruitment and selection.pptx
Restricting the recruitment and selection.pptxRestricting the recruitment and selection.pptx
Restricting the recruitment and selection.pptxRidaZaman1
 
performance appraisal and management.pptx
performance appraisal and management.pptxperformance appraisal and management.pptx
performance appraisal and management.pptxRidaZaman1
 
Managing HR Globally, Strategically Managing the HR.pptx
Managing HR Globally, Strategically Managing the HR.pptxManaging HR Globally, Strategically Managing the HR.pptx
Managing HR Globally, Strategically Managing the HR.pptxRidaZaman1
 
HR Development & Career Systems.pptx
HR Development & Career Systems.pptxHR Development & Career Systems.pptx
HR Development & Career Systems.pptxRidaZaman1
 
Health & Wellness Management.pptx
Health & Wellness Management.pptxHealth & Wellness Management.pptx
Health & Wellness Management.pptxRidaZaman1
 
Coaching Sponsoring And Mentoring.pptx
Coaching Sponsoring And Mentoring.pptxCoaching Sponsoring And Mentoring.pptx
Coaching Sponsoring And Mentoring.pptxRidaZaman1
 
Purchasing and Supplier Selection.pptx
Purchasing and Supplier Selection.pptxPurchasing and Supplier Selection.pptx
Purchasing and Supplier Selection.pptxRidaZaman1
 
micro teaching.pptx
micro teaching.pptxmicro teaching.pptx
micro teaching.pptxRidaZaman1
 
challenges faced by HR in the 21st century.pptx
challenges faced by HR in the 21st century.pptxchallenges faced by HR in the 21st century.pptx
challenges faced by HR in the 21st century.pptxRidaZaman1
 
mcdonalds.pptx
mcdonalds.pptxmcdonalds.pptx
mcdonalds.pptxRidaZaman1
 
The Role of Creativity In Entrepreneurship.pptx
The Role of Creativity In Entrepreneurship.pptxThe Role of Creativity In Entrepreneurship.pptx
The Role of Creativity In Entrepreneurship.pptxRidaZaman1
 
ON & OFF THE JOB TRAINING
ON & OFF THE JOB TRAINING ON & OFF THE JOB TRAINING
ON & OFF THE JOB TRAINING RidaZaman1
 
Case Study: Desert Survival
Case Study: Desert SurvivalCase Study: Desert Survival
Case Study: Desert SurvivalRidaZaman1
 
Case Study on Ihavemoved.com
Case Study on Ihavemoved.com Case Study on Ihavemoved.com
Case Study on Ihavemoved.com RidaZaman1
 
Product Life Cycle of Coca Cola Pakistan
Product Life Cycle of Coca Cola PakistanProduct Life Cycle of Coca Cola Pakistan
Product Life Cycle of Coca Cola PakistanRidaZaman1
 

More from RidaZaman1 (20)

Overview of the Subject of Human Resource Management
Overview of the Subject of Human Resource ManagementOverview of the Subject of Human Resource Management
Overview of the Subject of Human Resource Management
 
career management.pptx
career management.pptxcareer management.pptx
career management.pptx
 
Computer Networks
Computer NetworksComputer Networks
Computer Networks
 
Restricting the recruitment and selection.pptx
Restricting the recruitment and selection.pptxRestricting the recruitment and selection.pptx
Restricting the recruitment and selection.pptx
 
performance appraisal and management.pptx
performance appraisal and management.pptxperformance appraisal and management.pptx
performance appraisal and management.pptx
 
Managing HR Globally, Strategically Managing the HR.pptx
Managing HR Globally, Strategically Managing the HR.pptxManaging HR Globally, Strategically Managing the HR.pptx
Managing HR Globally, Strategically Managing the HR.pptx
 
HR Development & Career Systems.pptx
HR Development & Career Systems.pptxHR Development & Career Systems.pptx
HR Development & Career Systems.pptx
 
Health & Wellness Management.pptx
Health & Wellness Management.pptxHealth & Wellness Management.pptx
Health & Wellness Management.pptx
 
Coaching Sponsoring And Mentoring.pptx
Coaching Sponsoring And Mentoring.pptxCoaching Sponsoring And Mentoring.pptx
Coaching Sponsoring And Mentoring.pptx
 
Purchasing and Supplier Selection.pptx
Purchasing and Supplier Selection.pptxPurchasing and Supplier Selection.pptx
Purchasing and Supplier Selection.pptx
 
micro teaching.pptx
micro teaching.pptxmicro teaching.pptx
micro teaching.pptx
 
challenges faced by HR in the 21st century.pptx
challenges faced by HR in the 21st century.pptxchallenges faced by HR in the 21st century.pptx
challenges faced by HR in the 21st century.pptx
 
mcdonalds.pptx
mcdonalds.pptxmcdonalds.pptx
mcdonalds.pptx
 
The Role of Creativity In Entrepreneurship.pptx
The Role of Creativity In Entrepreneurship.pptxThe Role of Creativity In Entrepreneurship.pptx
The Role of Creativity In Entrepreneurship.pptx
 
JOB Analysis
JOB Analysis JOB Analysis
JOB Analysis
 
ON & OFF THE JOB TRAINING
ON & OFF THE JOB TRAINING ON & OFF THE JOB TRAINING
ON & OFF THE JOB TRAINING
 
Nestle
NestleNestle
Nestle
 
Case Study: Desert Survival
Case Study: Desert SurvivalCase Study: Desert Survival
Case Study: Desert Survival
 
Case Study on Ihavemoved.com
Case Study on Ihavemoved.com Case Study on Ihavemoved.com
Case Study on Ihavemoved.com
 
Product Life Cycle of Coca Cola Pakistan
Product Life Cycle of Coca Cola PakistanProduct Life Cycle of Coca Cola Pakistan
Product Life Cycle of Coca Cola Pakistan
 

Recently uploaded

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Recently uploaded (20)

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 

PYTHON

  • 2. Python • High Level Programming Language for general purpose programming ( general-purpose programming language is a programming language designed to be used for writing software in a wide variety of application domains) • Created by Guido Van Rossum • Release in 1991 • Interpreted not Compiled • Open Source CREATED BY RIDA ZAMAN 2
  • 3. Why Python? CREATED BY RIDA ZAMAN 3
  • 4. Advantages ● Easy to Learn ● Simple Syntax ● Write Less. Do More. ● Code Readability ● Versatile and Flexible CREATED BY RIDA ZAMAN 4
  • 5. Possibilities ● Machine Learning ● Computer Vision ● Web Development ● Game Development ● Web Scraping ● Desktop Applications CREATED BY RIDA ZAMAN 5
  • 6. Machine Learning ● Chat bots ● Speech Recognition ● Anti Virus ● Cancer Detection CREATED BY RIDA ZAMAN 6
  • 7. Computer Vision ● Self Driving Cars ● Image Recognition ● Gesture Recognition ● Robots ● Image Enhancement CREATED BY RIDA ZAMAN 7
  • 8. Web Development ● Instagram ● Youtube ● Pinterest CREATED BY RIDA ZAMAN 8
  • 10. Web Scraping ● News Scraping ● Price Comparison ● Reviews ● Monitoring CREATED BY RIDA ZAMAN 10 To grab or capture the textual information In a particular file format through a third party software without opening the web Page in a web browser
  • 12. CREATED BY RIDA ZAMAN 12 SCOPE
  • 13. Job Trends CREATED BY RIDA ZAMAN 13
  • 17. IDE’s for Python • Idle • Atom • Editra • PyCharm • Gedit • PythonWin • Spyder CREATED BY RIDA ZAMAN 17
  • 19. Basic syntax of a python program is too simple than other languages: Python: >>> print(“Hello World !”) Java: public class HelloWorld { public static void main(String[] args) { System.out.println("Hell o, World"); } } C : #include<stdio.h> void main() { printf(“Hello World !”); } CREATED BY RIDA ZAMAN 19
  • 20. Read User Input from Keyboard in Python: >>> # Python Basic Syntax - Example Program >>> strn = input("Enter your name: ") >>> print("Your name is ", strn); CREATED BY RIDA ZAMAN 20
  • 21. Comments: • Single line comment • All characters after hash (#) sign referred as comment (single line comment), up to the physical line end. • Example: # Python Basic Syntax - Example Program # We are comments print("Hello World, I am Python"); CREATED BY RIDA ZAMAN 21
  • 22. Multiline Comments: • multiline comments are used inside triple quotes.Multiline starting commenting code is ''' and ending with same, that is ''‘. • Example: ''' this Is Multiline comment ''‘ Print(“ Hello Python, n This is multiline comment”) CREATED BY RIDA ZAMAN 22
  • 23. Delete keyword: • To delete the variable in python, use the keyword del. • Example: num1 = 10 num2 = 20 print("num1 = ", num1, " and num2 = ", num2); del num1, num2 print("num1 = ", num1, " and num2 = ", num2); CREATED BY RIDA ZAMAN 23
  • 24. Strings: • Strings are contiguous set of characters in between quotation marks. You are free to use either pairs of single or double quotes to use the strings in your python program. • Example: str1 = 'Hello Python‘ str2 = "This is Python Strings Example" CREATED BY RIDA ZAMAN 24
  • 25. Concept and use of string in python: # Python String - Example str = 'Hello Python’ 1- print (str) # this will print the complete string 2- print (str[0]) # this will print the first character of the string 3- print (str[2:8]) # this will print the characters starting from 3rd to 8th 4- print (str[3:]) # this will print the string starting from the 4th character 5- print (str * 3) # this will print the string three times 6- print (str + "String") # this will print the concatenated string 7- Print (len(str)) # this will print the length of string CREATED BY RIDA ZAMAN 25
  • 26. Operators: • Arithmetic Operators • Comparison (Relational) Operators • Logical Operators • Assignment Operators • Bitwise Operators • Membership Operators • Identity Operators CREATED BY RIDA ZAMAN 26
  • 27. Operator Name Meaning + Addition Operator Add two values - Subtraction Operator Used for subtraction * Multiplication Operator Used for multiplication / Division Operator Used for division % Modulus Operator Returns remainder after dividing // Floor Division Operator Returns the quotient without any digits after decimal ** Exponent Operator Used to perform exponential calculation on operators CREATED BY RIDA ZAMAN 27 Python Arithmetic Operators Here the following table lists the arithmetic operators (7) available in python with their name and meaning:
  • 28. # Python Operators - Python Arithmetic Operators - Example Program num1 = 23 num2 = 10 print("If num1 = 23 and num2 = 10. Then,"); res = num1 + num2 print("num1 + num2 = ", res) res = num1 - num2 print("num1 - num2 = ", res) res = num1 * num2 print("num1 * num2 = ", res) res = num1 / num2 print("num1 / num2 = ", res) res = num1 % num2 print("num1 % num2 = ", res) #changing the values of num1 and num2 num1 = 2 num2 = 3 print("nIf num1 = 2 and num2 = 3. Then,"); res = num1 ** num2 print("num1 ** num2 = ", res) #again changing the values of num1 and num2 num1 = 10 num2 = 5 print("nIf num1 = 10 and num2 = 5. Then,"); res = num1 // num2 print("num1 // num2 = ", res) CREATED BY RIDA ZAMAN 28
  • 29. Python Comparison Operators: Operator Meaning == Returns true if values of the two operands are equal, otherwise returns false if not equal != Returns true if value of the two operands are not equal, otherwise returns false if equal > Returns true if value of the left operand is greater than right one, otherwise false if value of the right operand is greater than left one < Returns true if value of the left operand is less than right one, otherwise false if value of the right operand is less than left one >= Returns true if value of the left operand is greater than or equal to the value of the right one, otherwise false if value of the right operand is greater than left one <= Returns true if value of the left operand is less than or equal to right one, otherwise false if value of the right operand is less than or equal to left one CREATED BY RIDA ZAMAN 29 Here the following lists the comparison operators (6) available in Python:
  • 30. # Python Operators - Comparison Operators - Example Program num1 = 23 num2 = 10 print("If num1 = 23 and num2 = 10. Then,"); if(num1 == num2): print("num1 is equal to num2"); elif(num1 != num2): print("num1 is not equal to num2"); elif(num1 < num2): print("num1 is less than num2"); elif(num1 > num2): print("num1 is greater than num2"); elif(num1 <= num2): print("num1 is either less than or equal to num2"); elif(num1 >= num2): print("num1 is either greater than or equal to num2"); # changing the values of num1 and num2 num1 = 40 num2 = 40 print("n If num1 = 40 and num2 = 40. Then,"); if(num1 <= num2): print("num1 is either less than or equal to num2"); else: print("num1 is neither less than or equal to num2"); if(num1 >= num2): print("num1 is either greater than or equal to num2"); else: print("num1 is neither greater than or equal to num2"); CREATED BY RIDA ZAMAN 30
  • 31. Python Assignment Operators: Assume variable a holds 30 and variable b holds 18, and c is a variable. CREATED BY RIDA ZAMAN 31
  • 33. EXAMPLE CODE: a,b=30,18 print('a=',a) print('b=',b) c=a+b print('c=a+b=',c) c+=a #c=c+a c=48+30=78 now c is 78 print('c=c+a=',c) c-=a #c=c-a c=78-30=48 now c is 48 print('c=c-a=',c) c*=a #c=c*a c=48*30=1440 now c is 1440 print('c=c*a=',c) c/=a #c=c/a c=1440/30=48 now c is 48 CREATED BY RIDA ZAMAN 33
  • 34. CON’T: print('c=c/a=',c) c%=a #c=c%a c=48%30=18 now c is 18 print('c=c%a=',c) c**=a #c=c**a c=18^30=4.551715960790334e+37 now c is 4.551715960790334e+37 print('c=c^a=',c) c//=a #c=c//a c=4.551715960790334e+37//30=1.517238653596778e+3 6 now c is 1.517238653596778e+36 print('c=c//a‘,c) CREATED BY RIDA ZAMAN 34
  • 35. RESULT: a= 30 b= 18 c=a+b= 48 c=c+a= 78 c=c-a= 48 c=c*a= 1440 c=c/a= 48.0 c=c%a= 18.0 c=c^a= 4.551715960790334e+37 c=c//a 1.517238653596778e+36 CREATED BY RIDA ZAMAN 35
  • 36. Python Bitwise Operators : Bitwise operator works on bits and performs bit by bit operation. CREATED BY RIDA ZAMAN 36
  • 38. CON’T: Assume if a = 60; and b = 13; Now in binary format they will be as follows a=0011 1100 b=0000 1101 | Binary OR a | b Does a "bitwise or". Each bit of the output is 0 if the corresponding bit of a AND of b is 0, otherwise it's 1. CREATED BY RIDA ZAMAN 38
  • 39. CON’T: a & b Does a "bitwise and". Each bit of the output is 1 if the corresponding bit of a AND of b is 1, otherwise it's 0. CREATED BY RIDA ZAMAN 39
  • 40. CON’T: ^ Binary XOR x ^ y Does a "bitwise exclusive or". Each bit of the output is the same as the corresponding bit in x if that bit in y is 0, and it's the complement of the bit in x if that bit in y is 1. CREATED BY RIDA ZAMAN 40
  • 41. CON’T: ~ Binary Ones Complement ~ a Returns the complement of x - the number you get by switching each 1 for a 0 and each 0 for a 1. This is the same as -a - 1. CREATED BY RIDA ZAMAN 41
  • 42. CON’T: << Binary Left Shift a << 2 Returns a with the bits shifted to the left by 2 places (and new bits on the right-handside are zeros). a<<2 0 0 1 1 1 1 0 0<<2 1 1 1 1 0 0 0 0 240 >> Binary Right Shift a >> 2 Returns a with the bits shifted to the right by 2 places (and new bits on the left-hand side are zeros). a>>2 0 0 1 1 1 1 0 0>> 0 0 0 0 1 1 1 1 15 CREATED BY RIDA ZAMAN 42
  • 44. EXAMPLE CODE a=0b00111100 b=0b00001101 print('a=',bin(a),'b=',bin(b)) print('a or b is=',bin(a|b)) print('a and b is=',bin(a&b)) print('a xor b is=',bin(a^b)) print('Ones Complement of a=',bin(~a)) print('a Left Shift by 2 is',bin(a<<2)) print('a Right Shift by 2 is',bin(a>>2)) RESULT a= 0b111100 b= 0b1101 a or b is= 0b111101 a and b is= 0b1100 a xor b is= 0b110001 Ones Complement of a= -0b111101 a Left Shift by 2 is 0b11110000 a Right Shift by 2 is 0b1111 CREATED BY RIDA ZAMAN 44
  • 45. Python Logical Operators here are following logical operators supported by Python language. Assume variable a holds 10 and variable b holds 20 then CREATED BY RIDA ZAMAN 45
  • 46. EXAMPLE CODE a,b=10,20 c=c=(a>11)and (b>10) # 0 and 1 so result is false print(c) c=(a>11)or(b>10) # 0 or 1 so result is true print(c) a,b=10,20 c=not((a>11)and (b>10)) # not(0 and 1)=not(false) so result is true print(c) RESULT False True True CREATED BY RIDA ZAMAN 46
  • 47. Python Membership Operators Python’s membership operators test for membership in a sequence, such as strings, lists, or tuples. There are two membership operators as explained below. CREATED BY RIDA ZAMAN 47
  • 48. Python Logical Operators here are following logical operators supported by Python language. Assume variable a holds 10 and variable b holds 20 then CREATED BY RIDA ZAMAN 48
  • 49. EXAMPLE CODE a=[1,2,3,4,5,6,7,8,9,10] # a is a list print(3 in a) # 3 in list a so result is true print(20 in a) # 20 not in list a so result is false print(3 not in a) # 3 not in list a ,(but 3 in list a) so result is false print(20 not in a) # 20 not in list a ,(but 20 not in list a ) so result is true RESULT True False False True CREATED BY RIDA ZAMAN 49
  • 50. Python Identity Operators Identity operators compare the memory locations of two objects. There are two Identity operators as explained below. CREATED BY RIDA ZAMAN 50
  • 51. EXAMPLE CODE a,b=10,100 print(a is b) print(a is not b) RESULT False True CREATED BY RIDA ZAMAN 51
  • 52. Variables : Python is dynamically typed. You do not need to declare variables! The declaration happens automatically when you assign a value to a variable. CREATED BY RIDA ZAMAN 52 Variables can change type, simply by assigning them a new value of a different type.
  • 53. CON’T: Python allows you to assign a single value to several variables simultaneously. CREATED BY RIDA ZAMAN 53 You can also assign multiple objects to multiple variables.
  • 54. THE END SUBMITTED BY: RIDA ZAMAN RIDA FATIMA SADAF REASHEED CREATED BY RIDA ZAMAN 54