SlideShare a Scribd company logo
1 of 18
OPERATORS IN PYTHON
OPERATORS IN PYTHON
10/11/2021 OPEARATORS IN PYTHON 2
Arithmetic Operators
Relational Operators
Logical Operators
Bitwise Operator
Assignment Operator
Special Operator
ARITHMETIC
OPERATORS IN
PYTHON
Arithmetic
operators are used
to perform
mathematical
operations like
addition,
subtraction,
multiplication, etc.
10/11/2021 OPEARATORS IN PYTHON 3
Operator Description Syntax
+ Add two operands or unary plus x+y+2
- Subtract right operand from the
left or unary minus
x-y-2
* Multiply two operands x*y
** Exponent - left operand raised to
the power of right
x**y
/ Divide left operand by the right
one (always results into float)
x/y
// Floor division - division that
results into whole number
adjusted to the left in the number
line
x//y
% Modulus - remainder of the
division of left operand by the
right
x%y
ARITHMETIC
OPERATORS IN
PYTHON
Practical approach :
Arithmetic
operators
execution with
output
10/11/2021 OPEARATORS IN PYTHON 4
COMPARISION
OPERATORS IN
PYTHON
Comparison
operators are used
to compare values.
It returns either
True or False
according to the
condition.
10/11/2021 OPEARATORS IN PYTHON 5
Operator Description Syntax
> Greater than - True if left operand
is greater than the right
x>y
< Less than - True if left operand is
less than the right
y<x
== Equal to - True if both operands
are equal
x==y
!= Not equal to - True if operands
are not equal
x!=y
>= Greater than or equal to - True if
left operand is greater than or
equal to the right
x>=y
<= Less than or equal to - True if left
operand is less than or equal to
the right
x<=y
COMPARISION
OPERATORS IN
PYTHON
Practical approach :
Comparision
operators
execution with
output
10/11/2021 OPEARATORS IN PYTHON 6
BITWISE
OPERATORS IN
PYTHON
Bitwise operators
act on operands as
if they were strings
of binary digits.
They operate bit by
bit, hence the.
10/11/2021 OPEARATORS IN PYTHON 7
Operator Description Syntax
& Bitwise and x & y
| Bitwise or x|y
~ Bitwise not ~x
^ Bitwise XOR x ^ y
>> Bitwise right
shift
x>>y
<< Bitwise left shift x<<y
Truth Table
AND
OR
Ex-OR
A B A &B
0 0 0
0 1 0
1 0 0
1 1 1
A B A |B
0 0 0
0 1 1
1 0 1
1 1 1
A B A |B
0 0 0
0 1 1
1 0 1
1 1 0
Left shift
operator
e.g.x>>y
i.e.x*2^y
Right shift
operator
e.g.x>>y
i.e.x/2^y
Not
operator
Bitwise (Not) one's compliment operator will
invert the binary bits.
If a bit is 1, it will change it to 0.
If the bit is 0, it will change it to 1.
The ones' complement binary numeral system
is characterized by the bit complement of any
integer value being the arithmetic negative of
the value.
BITWISE
OPERATORS IN
PYTHON
Practical approach :
Bitwise operators
execution with
output
10/11/2021 OPEARATORS IN PYTHON 12
LOGICAL
OPERATORS IN
PYTHON
Logical operators
are and,or & not
operators. It returns
either True or False
according to the
operator.
Practical approach :
Comparision
operators
execution with
output
10/11/2021 OPEARATORS IN PYTHON 13
Operator Description Syntax
and True if both the operands are true x and y
or True if either of the operands is
true
x or y
not True if operand is false
(complements the operand)
x not y
ASSIGNMENT
OPERATORS IN
PYTHON
Assignment operators
are used to assign
values to variables.
There are various
compound operators
in Python like a+=5
that adds to the
variable and later
assigns the same. It is
equivalent to a=a+5
10/11/2021 OPEARATORS IN PYTHON 14
Operator Example Equivalent to
= x=7 x=7
+= x+=7 x=x+7
-= x-=7 x=x-7
*= x*=7 x=x*7
/= x/=7 x=x/7
//= x//=7 x=x//7
%= x%=7 x=x%7
**= x**=7 x=x**7
&= x&=7 x=x&7
|= x|=7 x=x|7
^= x^=7 x=x^7
>>= x>>=7 x=x>>7
<<= x<<=7 x<<7
Special Operators
Identity operator
is and is not are the identity
operators in Python. They are used
to check if two values (or
variables) are located on the same
part of the memory.
Membership
Operator
in and not in are the membership
operators in Python. They are used
to test whether a value or variable
is found in a sequence
(string,list,tuple,set and
dictionary)
Difference between is and == operator
The is keyword is used to test if
two variables refer to the same
object.
The test returns True if the two
objects are the same object.
The test returns False if they
are not the same object, even if
the two objects are 100%
equal.
Use the == operator to test if
two variables are equal.
SPECIAL
OPERATORS IN
PYTHON
Practical approach :
special operators
execution with
output
10/11/2021 OPEARATORS IN PYTHON 17
Python
Operator
Precedence
Precedence Operator Sign Operator Name
Highest () Parentheses
** Exponent
+x,-x,~x Unary plus, Unary
minus, Bitwise
NOT
*,/,//,% Multiplication,
Division, Floor
division, Modulus
+,- Addition,
Subtraction
<<,>> Bitwise shift
operator
& Bitwise AND
^ Bitwise XOR
| Bitwise OR
Lowest ==,!=,>,>=,<,<=,is,is
not,in,not in
Comparision,Ident
ity ,Membership
operators

More Related Content

What's hot

Passing an Array to a Function (ICT Programming)
Passing an Array to a Function (ICT Programming)Passing an Array to a Function (ICT Programming)
Passing an Array to a Function (ICT Programming)Fatima Kate Tanay
 
Map, Filter and Reduce In Python
Map, Filter and Reduce In PythonMap, Filter and Reduce In Python
Map, Filter and Reduce In PythonSimplilearn
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in pythoneShikshak
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array pptsandhya yadav
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programmingSrinivas Narasegouda
 
Operators in python
Operators in pythonOperators in python
Operators in pythoneShikshak
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in pythonJothi Thilaga P
 
An Introduction to Python Programming
An Introduction to Python ProgrammingAn Introduction to Python Programming
An Introduction to Python ProgrammingMorteza Zakeri
 
USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2vikram mahendra
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumarSujith Kumar
 
Looping Statements and Control Statements in Python
Looping Statements and Control Statements in PythonLooping Statements and Control Statements in Python
Looping Statements and Control Statements in PythonPriyankaC44
 
Python functions
Python functionsPython functions
Python functionsAliyamanasa
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in pythonTMARAGATHAM
 

What's hot (20)

Passing an Array to a Function (ICT Programming)
Passing an Array to a Function (ICT Programming)Passing an Array to a Function (ICT Programming)
Passing an Array to a Function (ICT Programming)
 
Map, Filter and Reduce In Python
Map, Filter and Reduce In PythonMap, Filter and Reduce In Python
Map, Filter and Reduce In Python
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array ppt
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
Operators in python
Operators in pythonOperators in python
Operators in python
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in python
 
An Introduction to Python Programming
An Introduction to Python ProgrammingAn Introduction to Python Programming
An Introduction to Python Programming
 
Python list
Python listPython list
Python list
 
Python recursion
Python recursionPython recursion
Python recursion
 
USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumar
 
Strings in python
Strings in pythonStrings in python
Strings in python
 
Array in c
Array in cArray in c
Array in c
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
 
Looping Statements and Control Statements in Python
Looping Statements and Control Statements in PythonLooping Statements and Control Statements in Python
Looping Statements and Control Statements in Python
 
Python functions
Python functionsPython functions
Python functions
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
 
Functions in Python
Functions in PythonFunctions in Python
Functions in Python
 

Similar to Operators in python

Python Training in Bangalore | Python Operators | Learnbay.in
Python Training in Bangalore | Python Operators | Learnbay.inPython Training in Bangalore | Python Operators | Learnbay.in
Python Training in Bangalore | Python Operators | Learnbay.inLearnbayin
 
Operators expressions-and-statements
Operators expressions-and-statementsOperators expressions-and-statements
Operators expressions-and-statementsCtOlaf
 
C++ Expressions Notes
C++ Expressions NotesC++ Expressions Notes
C++ Expressions NotesProf Ansari
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.netJaya Kumari
 
python operators.ppt
python operators.pptpython operators.ppt
python operators.pptErnieAcuna
 
Python tutorials for beginners | IQ Online Training
Python tutorials for beginners | IQ Online TrainingPython tutorials for beginners | IQ Online Training
Python tutorials for beginners | IQ Online TrainingRahul Tandale
 
Python Programming | JNTUK | UNIT 1 | Lecture 5
Python Programming | JNTUK | UNIT 1 | Lecture 5Python Programming | JNTUK | UNIT 1 | Lecture 5
Python Programming | JNTUK | UNIT 1 | Lecture 5FabMinds
 
lecture4 pgdca.pptx
lecture4 pgdca.pptxlecture4 pgdca.pptx
lecture4 pgdca.pptxclassall
 
Operator & Expression in c++
Operator & Expression in c++Operator & Expression in c++
Operator & Expression in c++bajiajugal
 
Operators
OperatorsOperators
OperatorsKamran
 

Similar to Operators in python (20)

Python Operators
Python OperatorsPython Operators
Python Operators
 
Python Training in Bangalore | Python Operators | Learnbay.in
Python Training in Bangalore | Python Operators | Learnbay.inPython Training in Bangalore | Python Operators | Learnbay.in
Python Training in Bangalore | Python Operators | Learnbay.in
 
Operators expressions-and-statements
Operators expressions-and-statementsOperators expressions-and-statements
Operators expressions-and-statements
 
C++ Expressions Notes
C++ Expressions NotesC++ Expressions Notes
C++ Expressions Notes
 
Operators
OperatorsOperators
Operators
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.net
 
Java script operators
Java script operatorsJava script operators
Java script operators
 
python operators.ppt
python operators.pptpython operators.ppt
python operators.ppt
 
5_Operators.pdf
5_Operators.pdf5_Operators.pdf
5_Operators.pdf
 
Python tutorials for beginners | IQ Online Training
Python tutorials for beginners | IQ Online TrainingPython tutorials for beginners | IQ Online Training
Python tutorials for beginners | IQ Online Training
 
Python Programming | JNTUK | UNIT 1 | Lecture 5
Python Programming | JNTUK | UNIT 1 | Lecture 5Python Programming | JNTUK | UNIT 1 | Lecture 5
Python Programming | JNTUK | UNIT 1 | Lecture 5
 
Java - Operators
Java - OperatorsJava - Operators
Java - Operators
 
Java 2
Java 2Java 2
Java 2
 
Coper in C
Coper in CCoper in C
Coper in C
 
lecture4 pgdca.pptx
lecture4 pgdca.pptxlecture4 pgdca.pptx
lecture4 pgdca.pptx
 
Operator & Expression in c++
Operator & Expression in c++Operator & Expression in c++
Operator & Expression in c++
 
Operators and it's type
Operators and it's type Operators and it's type
Operators and it's type
 
Operators
OperatorsOperators
Operators
 
Report on c
Report on cReport on c
Report on c
 
Types of Operators in C
Types of Operators in CTypes of Operators in C
Types of Operators in C
 

More from deepalishinkar1

Practical approach on numbers system and math module
Practical approach on numbers system and math modulePractical approach on numbers system and math module
Practical approach on numbers system and math moduledeepalishinkar1
 
Demonstration on keyword
Demonstration on keywordDemonstration on keyword
Demonstration on keyworddeepalishinkar1
 
Basic concepts of python
Basic concepts of pythonBasic concepts of python
Basic concepts of pythondeepalishinkar1
 
Data type list_methods_in_python
Data type list_methods_in_pythonData type list_methods_in_python
Data type list_methods_in_pythondeepalishinkar1
 

More from deepalishinkar1 (8)

Data handling in python
Data handling in pythonData handling in python
Data handling in python
 
Practical approach on numbers system and math module
Practical approach on numbers system and math modulePractical approach on numbers system and math module
Practical approach on numbers system and math module
 
Demonstration on keyword
Demonstration on keywordDemonstration on keyword
Demonstration on keyword
 
Numbers and math module
Numbers and math moduleNumbers and math module
Numbers and math module
 
Basic concepts of python
Basic concepts of pythonBasic concepts of python
Basic concepts of python
 
Introduction to python
Introduction to python Introduction to python
Introduction to python
 
Set methods in python
Set methods in pythonSet methods in python
Set methods in python
 
Data type list_methods_in_python
Data type list_methods_in_pythonData type list_methods_in_python
Data type list_methods_in_python
 

Recently uploaded

VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...
VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...
VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...Suhani Kapoor
 
PM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterPM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterHector Del Castillo, CPM, CPMM
 
Preventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxPreventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxGry Tina Tinde
 
Full Masii Russian Call Girls In Dwarka (Delhi) 9711199012 💋✔💕😘We are availab...
Full Masii Russian Call Girls In Dwarka (Delhi) 9711199012 💋✔💕😘We are availab...Full Masii Russian Call Girls In Dwarka (Delhi) 9711199012 💋✔💕😘We are availab...
Full Masii Russian Call Girls In Dwarka (Delhi) 9711199012 💋✔💕😘We are availab...shivangimorya083
 
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...Suhani Kapoor
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceSanjay Bokadia
 
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big BoodyDubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boodykojalkojal131
 
Call Girls Mukherjee Nagar Delhi reach out to us at ☎ 9711199012
Call Girls Mukherjee Nagar Delhi reach out to us at ☎ 9711199012Call Girls Mukherjee Nagar Delhi reach out to us at ☎ 9711199012
Call Girls Mukherjee Nagar Delhi reach out to us at ☎ 9711199012rehmti665
 
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service BhilaiVIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
Experience Certificate - Marketing Analyst-Soham Mondal.pdf
Experience Certificate - Marketing Analyst-Soham Mondal.pdfExperience Certificate - Marketing Analyst-Soham Mondal.pdf
Experience Certificate - Marketing Analyst-Soham Mondal.pdfSoham Mondal
 
Production Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjProduction Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjLewisJB
 
Delhi Call Girls Patparganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Patparganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Patparganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Patparganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...Suhani Kapoor
 
Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls DubaiDark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls Dubaikojalkojal131
 
NPPE STUDY GUIDE - NOV2021_study_104040.pdf
NPPE STUDY GUIDE - NOV2021_study_104040.pdfNPPE STUDY GUIDE - NOV2021_study_104040.pdf
NPPE STUDY GUIDE - NOV2021_study_104040.pdfDivyeshPatel234692
 
Internshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University CertificateInternshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University CertificateSoham Mondal
 
加利福尼亚艺术学院毕业证文凭证书( 咨询 )证书双学位
加利福尼亚艺术学院毕业证文凭证书( 咨询 )证书双学位加利福尼亚艺术学院毕业证文凭证书( 咨询 )证书双学位
加利福尼亚艺术学院毕业证文凭证书( 咨询 )证书双学位obuhobo
 
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service Cuttack
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service CuttackVIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service Cuttack
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service CuttackSuhani Kapoor
 
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...Niya Khan
 
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...shivangimorya083
 

Recently uploaded (20)

VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...
VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...
VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...
 
PM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterPM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring Chapter
 
Preventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxPreventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptx
 
Full Masii Russian Call Girls In Dwarka (Delhi) 9711199012 💋✔💕😘We are availab...
Full Masii Russian Call Girls In Dwarka (Delhi) 9711199012 💋✔💕😘We are availab...Full Masii Russian Call Girls In Dwarka (Delhi) 9711199012 💋✔💕😘We are availab...
Full Masii Russian Call Girls In Dwarka (Delhi) 9711199012 💋✔💕😘We are availab...
 
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector Experience
 
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big BoodyDubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
 
Call Girls Mukherjee Nagar Delhi reach out to us at ☎ 9711199012
Call Girls Mukherjee Nagar Delhi reach out to us at ☎ 9711199012Call Girls Mukherjee Nagar Delhi reach out to us at ☎ 9711199012
Call Girls Mukherjee Nagar Delhi reach out to us at ☎ 9711199012
 
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service BhilaiVIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
 
Experience Certificate - Marketing Analyst-Soham Mondal.pdf
Experience Certificate - Marketing Analyst-Soham Mondal.pdfExperience Certificate - Marketing Analyst-Soham Mondal.pdf
Experience Certificate - Marketing Analyst-Soham Mondal.pdf
 
Production Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjProduction Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbj
 
Delhi Call Girls Patparganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Patparganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Patparganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Patparganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...
 
Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls DubaiDark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
 
NPPE STUDY GUIDE - NOV2021_study_104040.pdf
NPPE STUDY GUIDE - NOV2021_study_104040.pdfNPPE STUDY GUIDE - NOV2021_study_104040.pdf
NPPE STUDY GUIDE - NOV2021_study_104040.pdf
 
Internshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University CertificateInternshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University Certificate
 
加利福尼亚艺术学院毕业证文凭证书( 咨询 )证书双学位
加利福尼亚艺术学院毕业证文凭证书( 咨询 )证书双学位加利福尼亚艺术学院毕业证文凭证书( 咨询 )证书双学位
加利福尼亚艺术学院毕业证文凭证书( 咨询 )证书双学位
 
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service Cuttack
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service CuttackVIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service Cuttack
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service Cuttack
 
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...
 
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
 

Operators in python

  • 2. OPERATORS IN PYTHON 10/11/2021 OPEARATORS IN PYTHON 2 Arithmetic Operators Relational Operators Logical Operators Bitwise Operator Assignment Operator Special Operator
  • 3. ARITHMETIC OPERATORS IN PYTHON Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication, etc. 10/11/2021 OPEARATORS IN PYTHON 3 Operator Description Syntax + Add two operands or unary plus x+y+2 - Subtract right operand from the left or unary minus x-y-2 * Multiply two operands x*y ** Exponent - left operand raised to the power of right x**y / Divide left operand by the right one (always results into float) x/y // Floor division - division that results into whole number adjusted to the left in the number line x//y % Modulus - remainder of the division of left operand by the right x%y
  • 4. ARITHMETIC OPERATORS IN PYTHON Practical approach : Arithmetic operators execution with output 10/11/2021 OPEARATORS IN PYTHON 4
  • 5. COMPARISION OPERATORS IN PYTHON Comparison operators are used to compare values. It returns either True or False according to the condition. 10/11/2021 OPEARATORS IN PYTHON 5 Operator Description Syntax > Greater than - True if left operand is greater than the right x>y < Less than - True if left operand is less than the right y<x == Equal to - True if both operands are equal x==y != Not equal to - True if operands are not equal x!=y >= Greater than or equal to - True if left operand is greater than or equal to the right x>=y <= Less than or equal to - True if left operand is less than or equal to the right x<=y
  • 6. COMPARISION OPERATORS IN PYTHON Practical approach : Comparision operators execution with output 10/11/2021 OPEARATORS IN PYTHON 6
  • 7. BITWISE OPERATORS IN PYTHON Bitwise operators act on operands as if they were strings of binary digits. They operate bit by bit, hence the. 10/11/2021 OPEARATORS IN PYTHON 7 Operator Description Syntax & Bitwise and x & y | Bitwise or x|y ~ Bitwise not ~x ^ Bitwise XOR x ^ y >> Bitwise right shift x>>y << Bitwise left shift x<<y
  • 8. Truth Table AND OR Ex-OR A B A &B 0 0 0 0 1 0 1 0 0 1 1 1 A B A |B 0 0 0 0 1 1 1 0 1 1 1 1 A B A |B 0 0 0 0 1 1 1 0 1 1 1 0
  • 11. Not operator Bitwise (Not) one's compliment operator will invert the binary bits. If a bit is 1, it will change it to 0. If the bit is 0, it will change it to 1. The ones' complement binary numeral system is characterized by the bit complement of any integer value being the arithmetic negative of the value.
  • 12. BITWISE OPERATORS IN PYTHON Practical approach : Bitwise operators execution with output 10/11/2021 OPEARATORS IN PYTHON 12
  • 13. LOGICAL OPERATORS IN PYTHON Logical operators are and,or & not operators. It returns either True or False according to the operator. Practical approach : Comparision operators execution with output 10/11/2021 OPEARATORS IN PYTHON 13 Operator Description Syntax and True if both the operands are true x and y or True if either of the operands is true x or y not True if operand is false (complements the operand) x not y
  • 14. ASSIGNMENT OPERATORS IN PYTHON Assignment operators are used to assign values to variables. There are various compound operators in Python like a+=5 that adds to the variable and later assigns the same. It is equivalent to a=a+5 10/11/2021 OPEARATORS IN PYTHON 14 Operator Example Equivalent to = x=7 x=7 += x+=7 x=x+7 -= x-=7 x=x-7 *= x*=7 x=x*7 /= x/=7 x=x/7 //= x//=7 x=x//7 %= x%=7 x=x%7 **= x**=7 x=x**7 &= x&=7 x=x&7 |= x|=7 x=x|7 ^= x^=7 x=x^7 >>= x>>=7 x=x>>7 <<= x<<=7 x<<7
  • 15. Special Operators Identity operator is and is not are the identity operators in Python. They are used to check if two values (or variables) are located on the same part of the memory. Membership Operator in and not in are the membership operators in Python. They are used to test whether a value or variable is found in a sequence (string,list,tuple,set and dictionary)
  • 16. Difference between is and == operator The is keyword is used to test if two variables refer to the same object. The test returns True if the two objects are the same object. The test returns False if they are not the same object, even if the two objects are 100% equal. Use the == operator to test if two variables are equal.
  • 17. SPECIAL OPERATORS IN PYTHON Practical approach : special operators execution with output 10/11/2021 OPEARATORS IN PYTHON 17
  • 18. Python Operator Precedence Precedence Operator Sign Operator Name Highest () Parentheses ** Exponent +x,-x,~x Unary plus, Unary minus, Bitwise NOT *,/,//,% Multiplication, Division, Floor division, Modulus +,- Addition, Subtraction <<,>> Bitwise shift operator & Bitwise AND ^ Bitwise XOR | Bitwise OR Lowest ==,!=,>,>=,<,<=,is,is not,in,not in Comparision,Ident ity ,Membership operators