SlideShare a Scribd company logo
Title - Sub
Basic Operators
• Python language supports the following types of operators.
 Arithmetic Operators
 Comparison (Relational) Operators
 Assignment Operators
 Logical Operators
 Bitwise Operators
 Membership Operators
 Identity Operators
Python – Arithmetic Operator
a=10, b=20
Addition: a + b = 30
Subtraction: a - b = 20
Multiplication: a * b = 200
Division: a / b = 2
Modulus: a % b = 0
Increment: b++ = 21
Decrement: b-- = 19
Python – Comparison Operator
a=10, b=20
Equal to: a == b : true
Not equal to: a != b : false
Greater than: a > b : false
Less than: a < b : true
Greater than or equal to: a >= b : false
Less than or equal to: a <= b : true
Python – Assignment Operator
Simple assignment operator: c=a+b //assign a+b to c
Add AND assignment operator: c+=a //assign c=c+a
Subtract AND assignment operator: c-=a //assign c=c-a
Multiply AND assignment operator: c*=a //assign c=c*a
Divide AND assignment operator: c/=a //assign c=c/a
Modulus AND assignment operator: c*=a //assign c=c*a
Lest shift AND assignment operator: c<<=2 //assign c=c<<2
Right shift AND assignment operator: c>>=2 //assign c=c>>2
Bitwise AND assignment operator: c&=2 //assign c=c&2
Bitwise exclusive AND assignment operator: c^=2 //assign c=c^2
Bitwise inclusive AND assignment operator: c|=2 //assign c=c|2
Python – Bitwise Operator
//integer format
a=60, b=13
//binary format
a=0011 1100
b=0000 1101
a&b = 0000 1100
a|b = 0011 1101
a^b = 0011 0001
~a = 1100 0011
Python – Logical Operator
a=true
b=false
Logical AND: a AND b : true
Logical OR: a OR b : true
Logical NOT: NOT(a AND b) : false
Python – Membership Operator
• in and not in are the membership operators;
• It is used to test whether a value or variable is in a sequence.
in True if value is found in the sequence
not in True if value is not found in the sequence
# Examples of Membership operator
x = 'Geeks for Geeks'
y = {3:'a',4:'b'}
print('G' in x)
print('geeks' not in x)
print('Geeks' not in x)
print(3 in y)
print('b' in y)
True
True
False
True
False
Ad

More Related Content

What's hot (20)

False Point Method / Regula falsi method
False Point Method / Regula falsi methodFalse Point Method / Regula falsi method
False Point Method / Regula falsi method
Nasima Akhtar
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
gavhays
 
Pronombres de complementos indirectos
Pronombres de complementos indirectosPronombres de complementos indirectos
Pronombres de complementos indirectos
GreenhillSpanish
 
Parts of speech
Parts of speechParts of speech
Parts of speech
Yanuar Hadi Saputro
 
powerpoint-active-passive-voice.ppt
powerpoint-active-passive-voice.pptpowerpoint-active-passive-voice.ppt
powerpoint-active-passive-voice.ppt
Christine58519
 
TENSES. PPT,PDF, 6,7,8 (1).pdf
TENSES. PPT,PDF, 6,7,8 (1).pdfTENSES. PPT,PDF, 6,7,8 (1).pdf
TENSES. PPT,PDF, 6,7,8 (1).pdf
Rajbharti12
 
Simple present and present continuous
Simple present and present continuousSimple present and present continuous
Simple present and present continuous
dbazaes
 
Unit v
Unit vUnit v
Unit v
TPLatchoumi
 
CMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of FunctionsCMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of Functions
allyn joy calcaben
 
2's complement
2's complement2's complement
2's complement
Arvenz Gavino
 
Combinational circuit
Combinational circuitCombinational circuit
Combinational circuit
Satya P. Joshi
 
Functions and its Applications in Mathematics
Functions and its Applications in MathematicsFunctions and its Applications in Mathematics
Functions and its Applications in Mathematics
Amit Amola
 
Floating point presentation
Floating point presentationFloating point presentation
Floating point presentation
SnehalataAgasti
 
Big-M Method Presentation
Big-M Method PresentationBig-M Method Presentation
Big-M Method Presentation
Nitesh Singh Patel
 
simplex method
simplex methodsimplex method
simplex method
Dronak Sahu
 
Comparators in DLD.
Comparators in DLD.Comparators in DLD.
Comparators in DLD.
Zain Jafri
 
Text Mode Programming in Assembly
Text Mode Programming in AssemblyText Mode Programming in Assembly
Text Mode Programming in Assembly
Javeria Yaqoob
 
Booths algorithm for Multiplication
Booths algorithm for MultiplicationBooths algorithm for Multiplication
Booths algorithm for Multiplication
Vikas Yadav
 
Lect 1 unit 2.pdf
Lect 1 unit 2.pdfLect 1 unit 2.pdf
Lect 1 unit 2.pdf
saijalvishwakarma12
 
MATRICES
MATRICESMATRICES
MATRICES
daferro
 
False Point Method / Regula falsi method
False Point Method / Regula falsi methodFalse Point Method / Regula falsi method
False Point Method / Regula falsi method
Nasima Akhtar
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
gavhays
 
Pronombres de complementos indirectos
Pronombres de complementos indirectosPronombres de complementos indirectos
Pronombres de complementos indirectos
GreenhillSpanish
 
powerpoint-active-passive-voice.ppt
powerpoint-active-passive-voice.pptpowerpoint-active-passive-voice.ppt
powerpoint-active-passive-voice.ppt
Christine58519
 
TENSES. PPT,PDF, 6,7,8 (1).pdf
TENSES. PPT,PDF, 6,7,8 (1).pdfTENSES. PPT,PDF, 6,7,8 (1).pdf
TENSES. PPT,PDF, 6,7,8 (1).pdf
Rajbharti12
 
Simple present and present continuous
Simple present and present continuousSimple present and present continuous
Simple present and present continuous
dbazaes
 
CMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of FunctionsCMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of Functions
allyn joy calcaben
 
Functions and its Applications in Mathematics
Functions and its Applications in MathematicsFunctions and its Applications in Mathematics
Functions and its Applications in Mathematics
Amit Amola
 
Floating point presentation
Floating point presentationFloating point presentation
Floating point presentation
SnehalataAgasti
 
Comparators in DLD.
Comparators in DLD.Comparators in DLD.
Comparators in DLD.
Zain Jafri
 
Text Mode Programming in Assembly
Text Mode Programming in AssemblyText Mode Programming in Assembly
Text Mode Programming in Assembly
Javeria Yaqoob
 
Booths algorithm for Multiplication
Booths algorithm for MultiplicationBooths algorithm for Multiplication
Booths algorithm for Multiplication
Vikas Yadav
 
MATRICES
MATRICESMATRICES
MATRICES
daferro
 

Similar to Python Basic Operators (20)

Java basic operators
Java basic operatorsJava basic operators
Java basic operators
Soba Arjun
 
C# Fundamentals - Basics of OOPS - Part 2
C# Fundamentals - Basics of OOPS - Part 2C# Fundamentals - Basics of OOPS - Part 2
C# Fundamentals - Basics of OOPS - Part 2
iFour Technolab Pvt. Ltd.
 
Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++
Himanshu Kaushik
 
C operators
C operatorsC operators
C operators
Rupanshi rawat
 
Programming C Part 02
Programming C Part 02Programming C Part 02
Programming C Part 02
Raselmondalmehedi
 
Arithmetic and increment decrement Operator
Arithmetic and increment decrement OperatorArithmetic and increment decrement Operator
Arithmetic and increment decrement Operator
Megha Sharma
 
COM1407: C Operators
COM1407: C OperatorsCOM1407: C Operators
COM1407: C Operators
Hemantha Kulathilake
 
intro to differnt oper.pptx
intro to differnt oper.pptxintro to differnt oper.pptx
intro to differnt oper.pptx
ssuser5ad1571
 
Coper in C
Coper in CCoper in C
Coper in C
thirumalaikumar3
 
C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh
AnkitSinghRajput35
 
11operator in c#
11operator in c#11operator in c#
11operator in c#
Sireesh K
 
Computer programming 2 Lesson 7
Computer programming 2  Lesson 7Computer programming 2  Lesson 7
Computer programming 2 Lesson 7
MLG College of Learning, Inc
 
Few Operator used in c++
Few Operator used in c++Few Operator used in c++
Few Operator used in c++
sunny khan
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++Increment and Decrement operators in C++
Increment and Decrement operators in C++
Neeru Mittal
 
PE1 Module 2.ppt
PE1 Module 2.pptPE1 Module 2.ppt
PE1 Module 2.ppt
balewayalew
 
Constructor and destructors
Constructor and destructorsConstructor and destructors
Constructor and destructors
divyalakshmi77
 
Operators in C/C++
Operators in C/C++Operators in C/C++
Operators in C/C++
Shobi P P
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
michaelaaron25322
 
C++ chapter 2
C++ chapter 2C++ chapter 2
C++ chapter 2
SHRIRANG PINJARKAR
 
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppthlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
PraveenaFppt
 
Java basic operators
Java basic operatorsJava basic operators
Java basic operators
Soba Arjun
 
Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++
Himanshu Kaushik
 
Arithmetic and increment decrement Operator
Arithmetic and increment decrement OperatorArithmetic and increment decrement Operator
Arithmetic and increment decrement Operator
Megha Sharma
 
intro to differnt oper.pptx
intro to differnt oper.pptxintro to differnt oper.pptx
intro to differnt oper.pptx
ssuser5ad1571
 
C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh
AnkitSinghRajput35
 
11operator in c#
11operator in c#11operator in c#
11operator in c#
Sireesh K
 
Few Operator used in c++
Few Operator used in c++Few Operator used in c++
Few Operator used in c++
sunny khan
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++Increment and Decrement operators in C++
Increment and Decrement operators in C++
Neeru Mittal
 
PE1 Module 2.ppt
PE1 Module 2.pptPE1 Module 2.ppt
PE1 Module 2.ppt
balewayalew
 
Constructor and destructors
Constructor and destructorsConstructor and destructors
Constructor and destructors
divyalakshmi77
 
Operators in C/C++
Operators in C/C++Operators in C/C++
Operators in C/C++
Shobi P P
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
michaelaaron25322
 
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppthlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
PraveenaFppt
 
Ad

More from Soba Arjun (20)

Java interview questions
Java interview questionsJava interview questions
Java interview questions
Soba Arjun
 
Java modifiers
Java modifiersJava modifiers
Java modifiers
Soba Arjun
 
Java variable types
Java variable typesJava variable types
Java variable types
Soba Arjun
 
Java basic datatypes
Java basic datatypesJava basic datatypes
Java basic datatypes
Soba Arjun
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questions
Soba Arjun
 
C interview questions
C interview questionsC interview questions
C interview questions
Soba Arjun
 
Technical interview questions
Technical interview questionsTechnical interview questions
Technical interview questions
Soba Arjun
 
Php interview questions with answer
Php interview questions with answerPhp interview questions with answer
Php interview questions with answer
Soba Arjun
 
Computer Memory Types - Primary Memory - Secondary Memory
Computer Memory Types - Primary Memory - Secondary MemoryComputer Memory Types - Primary Memory - Secondary Memory
Computer Memory Types - Primary Memory - Secondary Memory
Soba Arjun
 
Birds sanctuaries
Birds sanctuariesBirds sanctuaries
Birds sanctuaries
Soba Arjun
 
Important operating systems
Important operating systemsImportant operating systems
Important operating systems
Soba Arjun
 
Important branches of science
Important branches of scienceImportant branches of science
Important branches of science
Soba Arjun
 
Important file extensions
Important file extensionsImportant file extensions
Important file extensions
Soba Arjun
 
Java Abstraction
Java AbstractionJava Abstraction
Java Abstraction
Soba Arjun
 
Java Polymorphism
Java PolymorphismJava Polymorphism
Java Polymorphism
Soba Arjun
 
Java Overriding
Java OverridingJava Overriding
Java Overriding
Soba Arjun
 
Java Inner Classes
Java Inner ClassesJava Inner Classes
Java Inner Classes
Soba Arjun
 
java Exception
java Exceptionjava Exception
java Exception
Soba Arjun
 
Java Methods
Java MethodsJava Methods
Java Methods
Soba Arjun
 
java Inheritance
java Inheritancejava Inheritance
java Inheritance
Soba Arjun
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
Soba Arjun
 
Java modifiers
Java modifiersJava modifiers
Java modifiers
Soba Arjun
 
Java variable types
Java variable typesJava variable types
Java variable types
Soba Arjun
 
Java basic datatypes
Java basic datatypesJava basic datatypes
Java basic datatypes
Soba Arjun
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questions
Soba Arjun
 
C interview questions
C interview questionsC interview questions
C interview questions
Soba Arjun
 
Technical interview questions
Technical interview questionsTechnical interview questions
Technical interview questions
Soba Arjun
 
Php interview questions with answer
Php interview questions with answerPhp interview questions with answer
Php interview questions with answer
Soba Arjun
 
Computer Memory Types - Primary Memory - Secondary Memory
Computer Memory Types - Primary Memory - Secondary MemoryComputer Memory Types - Primary Memory - Secondary Memory
Computer Memory Types - Primary Memory - Secondary Memory
Soba Arjun
 
Birds sanctuaries
Birds sanctuariesBirds sanctuaries
Birds sanctuaries
Soba Arjun
 
Important operating systems
Important operating systemsImportant operating systems
Important operating systems
Soba Arjun
 
Important branches of science
Important branches of scienceImportant branches of science
Important branches of science
Soba Arjun
 
Important file extensions
Important file extensionsImportant file extensions
Important file extensions
Soba Arjun
 
Java Abstraction
Java AbstractionJava Abstraction
Java Abstraction
Soba Arjun
 
Java Polymorphism
Java PolymorphismJava Polymorphism
Java Polymorphism
Soba Arjun
 
Java Overriding
Java OverridingJava Overriding
Java Overriding
Soba Arjun
 
Java Inner Classes
Java Inner ClassesJava Inner Classes
Java Inner Classes
Soba Arjun
 
java Exception
java Exceptionjava Exception
java Exception
Soba Arjun
 
java Inheritance
java Inheritancejava Inheritance
java Inheritance
Soba Arjun
 
Ad

Recently uploaded (20)

Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
The History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptxThe History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx
mansk2
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Cultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptxCultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptx
UmeshTimilsina1
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx
mansk2
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Cultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptxCultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptx
UmeshTimilsina1
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 

Python Basic Operators

  • 2. Basic Operators • Python language supports the following types of operators.  Arithmetic Operators  Comparison (Relational) Operators  Assignment Operators  Logical Operators  Bitwise Operators  Membership Operators  Identity Operators
  • 3. Python – Arithmetic Operator a=10, b=20 Addition: a + b = 30 Subtraction: a - b = 20 Multiplication: a * b = 200 Division: a / b = 2 Modulus: a % b = 0 Increment: b++ = 21 Decrement: b-- = 19
  • 4. Python – Comparison Operator a=10, b=20 Equal to: a == b : true Not equal to: a != b : false Greater than: a > b : false Less than: a < b : true Greater than or equal to: a >= b : false Less than or equal to: a <= b : true
  • 5. Python – Assignment Operator Simple assignment operator: c=a+b //assign a+b to c Add AND assignment operator: c+=a //assign c=c+a Subtract AND assignment operator: c-=a //assign c=c-a Multiply AND assignment operator: c*=a //assign c=c*a Divide AND assignment operator: c/=a //assign c=c/a Modulus AND assignment operator: c*=a //assign c=c*a Lest shift AND assignment operator: c<<=2 //assign c=c<<2 Right shift AND assignment operator: c>>=2 //assign c=c>>2 Bitwise AND assignment operator: c&=2 //assign c=c&2 Bitwise exclusive AND assignment operator: c^=2 //assign c=c^2 Bitwise inclusive AND assignment operator: c|=2 //assign c=c|2
  • 6. Python – Bitwise Operator //integer format a=60, b=13 //binary format a=0011 1100 b=0000 1101 a&b = 0000 1100 a|b = 0011 1101 a^b = 0011 0001 ~a = 1100 0011
  • 7. Python – Logical Operator a=true b=false Logical AND: a AND b : true Logical OR: a OR b : true Logical NOT: NOT(a AND b) : false
  • 8. Python – Membership Operator • in and not in are the membership operators; • It is used to test whether a value or variable is in a sequence. in True if value is found in the sequence not in True if value is not found in the sequence # Examples of Membership operator x = 'Geeks for Geeks' y = {3:'a',4:'b'} print('G' in x) print('geeks' not in x) print('Geeks' not in x) print(3 in y) print('b' in y) True True False True False
  翻译: