• Teaching
    • Montessori Teacher Training 🔥
    • Yoga Teacher Training
  • Coding
    • Full Stack Development Course
    • Data Science Course
    • Python Programming Course
    • Software Testing Course
    • Architecting on AWS
  • Commerce
    • PwC Edge : Strategic Accounting and Finance Programme
    • ACCA Course
    • SAP Fico Course
    • Practical Accounting Course
    • SAP MM Course
    • HR Management Course in Kerala
  • Technical
    • Structural Design Course
    • Embedded Systems Software Engineering in Kerala
    • MEP Course
    • MEP QS Course
    • BIM Training Course
    • Quantity Survey Course
  • Finacademy
    • Forex Trading Course
    • Stock Market Course
    • Mutual Funds Course in Kerala
  • Digital Marketing
    • Digital Marketing Course
    • Performance Marketing Course
  • Language Learning
    • Spoken English Course
    • German Language Course
    • IELTS Exam Coaching
  • Exam Preparation
    • Kerala PSC Coaching
    • Kerala PSC LGS Coaching
    • KAS Coaching
    • Kerala PSC LDC Coaching
    • Kerala PSC LSGS Coaching
    • KPSC Industries Extension Officer Coaching
    • KPSC Technical Mechanical Coaching
    • KPSC Technical Electrical Coaching
    • Kerala PSC Technical Exam Preparation
    • KPSC Technical Civil Coaching
    • SBI PO Coaching
    • IBPS Clerk Coaching
    • IBPS PO Coaching
    • IBPS SO Coaching
    • Bank Exam Coaching
    • Lecturer in DIET Course
    • Kpsc HSA Coaching
    • KPSC LP UP Assistant Coaching
    • EMRS Coaching
    • KTET Coaching
    • SSC Coaching
    • SSC JE Coaching
    • SSC CGL Coaching
    • SSC CHSL Coaching
    • SSC MTS Coaching
    • UPSC Coaching
  • Health Care
    • DHA Course
    • OET Coaching
  • Other Exams
    • GATE Coaching
    • CAT Coaching
    • MAT Online Coaching
    • KMAT Online Coaching
Entri Blog
No Result
View All Result
Thursday, May 15, 2025
  • Kerala PSC
    • Kerala PSC General
      • Kerala PSC Exams
      • KAS Exam
      • Kerala PSC VEO Notification
      • Kerala Police SI
      • Kerala PSC LDC Notification
      • Kerala PSC Village Field Assistant Notification
      • Kerala PSC LD Typist Notification
      • Kerala PSC Food Safety Officer
      • Kerala PSC Excise Inspector Notification
      • Kerala PSC BDO Notification
      • Kerala PSC CPO Notification
      • Kerala PSC LGS Notification
      • Fire and Rescue Officer
      • Women Fire and Rescue Officer
    • Kerala PSC Teaching
      • Kerala PSC HSA
      • Kerala PSC HSST
      • KTET
      • LP/UP Assistant
      • KVS
      • Railway Teacher
    • Kerala PSC Technical
      • LSGD AE
      • Draftsman/Overseer
      • IEO
      • ATP
      • Polytechnic Lecturer
      • AE Electronics
      • Assistant Engineer
  • Banking
    • IBPS PO Notification
    • IBPS Clerk Notification
    • SBI PO Notification
    • SBI Clerk Notification
    • SBI SO Notification
    • SBI Apprentice Notification
    • Canara Bank PO Notification
    • Indian Bank PO Notification
    • RBI Assistant Notification
    • RBI Office Attendant Notification
    • IBPS RRB Notification
    • IBPS RRB Office Assistant Notification
  • Skilling
    • Coding
    • Spoken English
    • Stock Market
      • Share Market Today News
      • Share Market Analysis
    • Digital Marketing
    • Accounting Course
    • SAP
    • OET
    • German
    • IELTS
    • Quantity Survey
    • MEP
    • Structural Design
    • Montessori
    • Yoga Teaching
    • Oil and Gas
  • Courses
    • Data Science Course
      • Data Science Malayalam
      • Data Science Course in Tamil
      • Data Science Course in Telugu
      • Data Science Training in Kochi
      • Data Science Training in Trivandrum
      • Data Science Course in Calicut
      • Data Science Training in Thrissur
    • Data Analytics Course
      • Data Analytics Course in Malayalam
      • Data Analytics Course in Tamil
      • Data Analytics Course in Telugu
    • Technical Upskilling
      • Quantity Surveying Course
      • Structural Design Course
      • BIM Course in Kerala
      • MEP Course
      • Embedded System Course
      • MEP Quantity Surveying Course
      • MEP Course in Kochi
      • Quantity Surveyor Course in Tamil
      • Quantity Surveying Course in Telugu
      • Quantity Surveyor Course in Hyderabad
      • Quantity Surveying Course in Chennai
      • MEP Design Course in Kerala
      • HVAC Course
      • Steel Structure Design Course
      • RCC Design Course
    • Full Stack Developer Course
      • Full Stack Development Malayalam
      • Full Stack Development Hindi
      • Full Stack Development Tamil
      • Full Stack Development Telugu
      • Full Stack Development Kannada
    • Stock Market Course
      • Stock Market Course in Malayalam
      • Stock Market Course in Tamil
      • Stock Market Course in Kannada
      • Options Trading Course
    • Mutual Funds Course
    • Forex Trading Course
    • Spoken English Course
      • Spoken English Course in Malayalam
      • Spoken English Course in Hindi
      • Spoken English Course in Telugu
      • Spoken English Course in Tamil
      • Spoken English Course in Kannada
    • Python Programming Course
    • Software Testing Course
      • Software Testing Course in Malayalam
      • Software Testing Course in Tamil
      • Software Testing Course in Telugu
    • AWS Solutions Architect Associate Course
    • PwC Edge : Strategic Accounting and Finance Programme
    • Practical Accounting Course
      • Accounting Course in Malayalam
      • Accounting Course in Tamil
      • Tally Course
      • Taxation Course
      • UAE Accounting
      • GST Course
      • Zoho Books Training
      • GST Practitioner Course in Kerala
      • GCC VAT Course
    • ACCA Training Online
      • ACCA Course in Kerala
    • SAP Training Courses
      • SAP FICO Course
      • SAP MM Course
      • SAP SD Training
      • SAP FICO Course in Tamil
      • SAP MM Course in Tamil
    • HR Management Course
    • Performance Marketing Course
    • Mern Stack Developer Course
      • Full Stack Developer Course in Kochi
      • Full Stack Developer Course in Trivandrum
      • Full Stack Developer Course in Calicut
      • Full Stack Developer Course in Pune
      • Full Stack Developer Course in Bangalore
      • Full Stack Developer Course in Hyderabad
      • Full Stack Developer Course in Chennai
      • Full Stack Developer Course in Indore
      • Full Stack Developer Course in Jaipur
      • Full Stack Developer Course in Coimbatore
    • Digital Marketing Training
      • Digital Marketing Course in Kochi
      • Digital Marketing Course in Trivandrum
      • Digital Marketing Course in Calicut
      • Digital Marketing Course in Kollam
      • Digital Marketing Course in Thrissur
      • Digital Marketing Course in Kottayam
      • Digital Marketing Course in Kannur
    • Montessori Teacher Training
      • Montessori Teacher Training in Calicut
      • Montessori Teacher Training in Kochi, Ernakulam
      • Montessori Teacher Training in Trivandrum
      • Montessori Teacher Training in Kollam
      • Montessori Teacher Training in Malayalam
      • Montessori Teacher Training in Kannada
    • Other Courses
      • German Language Course
      • OET Coaching
        • OET for Pharmacist
        • OET for Nurses
      • DHA Course
      • MOH Exam Coaching
      • Nurses Recruitment Abroad
      • FMGE Coaching
      • ChatGPT Course
      • Forex Trading Course
      • Yoga Teacher Training Course
      • Diploma in Early Childhood Care and Education
      • Business Administration & Hospital Management Course
      • Hospital and Healthcare Administration
      • AI for Teachers Course
  • Others
    • Railway
      • RRB Technician Notification
      • RRB JE Notification
      • RRB ALP Notification
      • RRB NTPC Notification
      • RRB RPF Notification
      • RRB RPF SI Notification
      • RRB RPF Constable Notification
      • RRB Group D Notification
      • RRB RPSF SI Notification
      • RRB SSE Notification
    • SSC
      • SSC CPO Notification
      • SSC MTS Notification
      • SSC CGL Notification
      • SSC CHSL Notification
      • SSC GD Constable Notification
      • SSC Stenographer Notification
      • SSC JE Notification
      • SSC CAPF Notification
      • SSC JHT Notification
      • Delhi Police Constable Notification
      • Delhi Police SI Notification
    • GATE
    • MAT
    • KMAT
      • KMAT Kerala 2024
    • TET
      • APTET
      • CTET
      • DSSSB
      • Karnataka TET
      • Kerala TET
        • KTET Notification
      • KVS
      • MPTET
      • SUPER TET
      • TNTET
      • TSTET
      • UPTET
    • UPSC
      • UPSC CAPF Notification
      • UPSC CDS Notification
      • UPSC NDA Notification
      • UPSC Civil service Notification
  • Free Learn
    • Free Courses
      • Free Coding Courses
        • C Langauge Courses
        • Free Data Science Courses
        • Free Full Stack Developer Courses
        • Free Python Programming Courses
      • Free Accounting Courses
      • Free Digital Marketing Courses
        • Free SEO Courses
        • Web Development for Marketers
      • Engineering Upskilling Courses
      • Free Hospital Administration Courses
      • Free OET Training
      • Free SAP Courses
      • Free Teachers Training Courses
      • Free Trading Courses
        • Free Stock Market Courses in Malayalam
        • Free Options Trading Course Malayalam
        • Free Forex Trading Courses Malayalam
        • Free Personal Finance Courses Malayalam
    • Question Answer
    • Aptitude Questions
    • Webinars
  • Test Prep
    • Kerala PSC Coaching
      • KPSC Degree Level Exam Preparation
      • Kerala PSC 12th Level Exam Preparation
      • Kerala PSC 10th Level Exam Preparation
      • KAS Coaching
      • Kerala PSC LDC Coaching
      • Kerala PSC LD Typist Coaching
      • Kerala PSC Fireman Coaching
      • KSFE Assistant Exam Preparation
      • Secretariat Office Attendant Coaching
      • Secretariat Assistant Coaching
      • Kerala PSC SI Exam Coaching
      • Khadi Board LDC Exam Preparation
      • Devaswom Board LDC Coaching
      • University LGS Exam Preparation
      • University Assistant Exam Coaching
      • KPSC Scientific Officer Exam Coaching
      • KPSC Probation Officer Grade II
      • KPSC Food Safety Officer Coaching
      • KWA Sanitary Chemist Coaching
      • KPSC Diary Farm Instructor Exam Coaching
      • Kerala PSC KWA Lab Assistant Exam Coaching
      • Kerala PSC ICDS Supervisor Exam Coaching
      • KPSC Finger Print Searcher Coaching
      • Kerala PSC Welfare Officer Gr. II Exam Coaching
      • KPSC Assistant Dental Surgeon Coaching
    • KPSC Teaching Exams
      • HSA Exam Preparation
      • KPSC HSA Social Science Coaching
      • KPSC HSA Physical Science Coaching
      • KPSC HSA English Coaching
      • KPSC Junior Language Teacher Hindi
      • KTET Coaching
      • SET Coaching
      • LP/UP Assistant Exam Coaching
      • HSST Exam Preparation
      • HSST Commerce Exam Coaching
      • Kerala PSC Lecturer in Diet Coaching
      • KVS PGT/TGT Coaching
    • Kerala PSC Technical Exams Coaching
      • Assistant Engineer Electrical Exam Coaching
      • Assistant Engineer Electronics Coaching
      • Assistant Engineer Mechanical Coaching
      • Kerala PSC Industries Extension Officer Coaching
      • KPSC LSGD AE Exam Coaching
      • KPSC Civil Engineering Exam Coaching
      • KPSC Mechanical Engineering Exam Coaching
      • KPSC Electrical Engineering Exam Coaching
      • KPSC Electronics Engineering Exam Coaching
      • KPSC Technical Computer Science Coaching
      • KPSC Tradesman Turning Coaching
      • Kerala PSC Overseer Exam Coaching
      • KPSC Assistant Town Planner Coaching
      • Lecturer in Polytechnic Electronics Coaching
    • Teaching Exams Coaching
      • CSIR NET Exam Coaching
      • EMRS Coaching
      • CTET Exam Online Coaching
    • IELTS Training Online
    • Bank Exam Coaching Online
      • SEBI Grade A Coaching
      • IBPS SO Online Coaching
      • IBPSC PO Online Coaching
      • IBPSC Clerk Online Coaching
      • SBI PO Coaching
      • SBI Clerk Online Coaching
      • SBI Apprentice Class
      • SBI SO Online Coaching
      • RBI Grade B Coaching
      • RBI Assistant Coaching
      • CSEB Exam Coaching
      • IBPS RRB Coaching
      • IBPS RRB PO Coaching
      • Canara Bank Po Exam Coaching
      • Kerala Gramin Bank Coaching
      • Kerala Bank Exam Coaching
        • Kerala Bank Clerk Exam Coaching
        • Kerala Bank Office Attendant Exam Coaching
        • Kerala Bank Assistant Manager Exam Coaching
      • JCI Exam Coaching
      • NABARD Grade A Coaching
      • LIC AAO Coaching Online
    • UPSC Online Coaching
      • UPSC CAPF Online Coaching
    • SSC Online Coaching
      • SSC JE Online Coaching
      • SSC CGL Coaching
      • SSC CGL AAO Coaching
      • SSC CGL CBI Inspector Coaching
      • SSC CHSL Coaching
      • SSC MTS Coaching
      • SSC Stenographer Coaching
      • SSC GD Online Coaching
    • RRB Exams Coaching
      • RRB RPF Exam Coaching
      • RRB NTPC Exam Coaching
      • RRB JE Online Coaching
      • RRB JE Electronics Coaching
      • RRB ALP Exam Coaching
      • RRB Technician Exam Coaching
    • CAT Online Coaching
    • CMAT Online Coaching
    • XAT Exam Coaching
    • GATE Online Coaching
      • GATE CE Online Coaching
      • GATE ME Online Coaching
      • GATE EE Online Coaching
    • NMAT Exam Coaching
    • AAI ATC Jr Executive Coaching
    • Cochin Shipyard Executive Trainee Coaching
    • BEL Probationary Engineer Coaching
    • HPCL Junior Executive Coaching
Free Courses
Entri Blog
  • HTML Tutorial
  • DSA Tutorials
  • Tutorials in Hindi
    • HTML Tutorial for Beginners in Hindi
    • Python Tutorial for Beginners in Hindi
    • GIT and GITHUB Tutorial for Beginners in Hindi
  • Tutorials in Tamil
    • JavaScript Tutorial in Tamil
  • Tutorials in Telugu
    • HTML Tutorial For Beginners in Telugu
    • CSS Tutorial for Beginners in Telugu
    • Bootstrap Tutorial for Beginner in Telugu
  • Tutorials in Kannada
    • HTML Tutorial For Beginners in Kannada
entri exclusive offers entri exclusive offers
Home Articles

What are the different types of operators in Python

by Feeba Mahin
November 22, 2022
in Articles, Python Programming
What are the different types of operators in Python
Share on FacebookShare on WhatsAppShare on Telegram

Table of Contents

  • Python Operators
  • Assignment Operators in Python
  • Python Relational Operators
  • Python Arithmetic Operators

Constructs in Python programming language that instruct the interpreter to perform a certain function involving two or more variables upon which the construct operates are called python operators. Though not actually seen as functions, they have their own identity as concepts because they are different syntactically and semantically from functions. It performs tasks of various nature, including arithmetic, bitwise, membership, identity, comparison, assignment, and logic, etc., with a certain order of execution existing among them.Python and Machine Learning Rectangle

Python Operators

Operators in python are constructs in Python that instruct the interpreter to perform a certain function; however, these are traditionally not defined as functions; rather, they are syntactically and semantically different from functions. Operators are used to performing operations on variables and values according to their use.

Python language supports the following types of operators.

  1. Arithmetic Operators
  2. Bitwise Operators
  3. Membership Operators
  4. Identity Operators
  5. Comparison Operators
  6. Assignment Operators
  7. Logical Operators

1. Arithmetic Operator

Arithmetic operators are used to performing mathematical operations

Operator Description Syntax Output
+ Addition a+b Returns sum of the operands
– Subtraction a-b Returns Difference of the operands
/ Division a/b Returns Quotient of the operands
* Multiplication a*b Returns product of the operands
** Exponentiation a**b returns exponent of a raised to the power b
% Modulus a%b returns remainder of the division
// Floor division a//b returns a real value and ignores the decimal part

Let us consider an example program for carrying out the arithmetic operations explained above.

Let us consider two integers Xa=2 and Xb=3

Program

Xa = int(input('Enter First number: '))
Xb = int(input('Enter Second number: '))
add = Xa + Xb
diff = Xa - Xb
mul = Xa * Xb
div = Xa / Xb
floor_div = Xa // Xb
power = Xa ** Xb
modulus = Xa % Xb
print('Sum of the numbers is',Xa ,'and' ,Xb ,'is :',add)
print('Difference of the numbers is ',Xa ,'and' ,Xb ,'is :',diff)
print('Product of the numbers is ' ,Xa ,'and' ,Xb ,'is :',mul)
print('Division of the numbers is ',Xa ,'and' ,Xb ,'is :',div)
print('Floor Division of the numbers is ',Xa ,'and' ,Xb ,'is :',floor_div)
print('Exponent of the numbers is ',Xa ,'and' ,Xb ,'is :',power)
print('Modulus of the numbers is ',Xa ,'and' ,Xb ,'is :',modulus)

Output

o1

2. Bitwise Operators

Refers to the operators working on a bit, i.e. they treat the operand as a string of bits; for example, in bitwise operations, 5 will be considered as 0101.

The box below provides the bitwise operators in python

Operator Description Syntax Output
& Binary AND a&b copies a bit to the result if it exists in both operands
| Binary OR a|b copies a bit if it exists in either operand.
^ Binary XOR a^b copies the bit if it is set in one operand but not both.
~ Binary One’s Complement a~b Unary operation of flipping bits
<< Binary Left Shift a<<b The left operands value is moved left by the number of bits specified by the right operand.
>> Binary Right Shift a>>b left operands value is moved right by the number of bits specified by the right operand.

3. Membership Operators

Refers to the operators used in the validation of membership of operand test in a sequence, such as strings, lists, or tuples. There are two types of membership operators in python.


Operator Syntax Output
in if (a in x): Evaluates to true if it finds a variable in the specified sequence and false otherwise.
not in If ( b not in x ): Evaluates to true if it does not finds a variable in the specified sequence and false otherwise.

4. Identity Operators

Used to compare the operands’ memory locations, they are quite often used to determine if the operand is of a particular type; there are two types of identity operators in python.

Operator Syntax Output
is x is y returns True if the type of the value in y points to the same type in the x.
is not x is not y returns True if the type of the value in y points to a different type than the value in the x

5. Comparison Operators

Also known as Relational operators, these operators are used in determining the relation between the operand on either side of the operator.

Operator Syntax Output
== (a == b) If the values of a and b are equal, then the condition becomes true.
!= (a != b) If values of a and b are not equal, then the condition becomes true.
<> (a <> b) If values of a and b are not equal, then the condition becomes true.
> (a > b) If the value of a is greater than the value of b, then the condition becomes true.
< (a < b) If the value of a is less than the value of b, then the condition becomes true.
>= (a >= b) If the value of a is greater than or equal to the value of b, then the condition becomes true.
<= (a <= b) If the value of b is less than or equal to the value of b, then the condition becomes true.

6. Assignment Operators

Referred as the name suggests, it is used to declare assignments to the operands; the following are the types of assignment operators in python.

Operator Description Syntax Output
= Equal to c = a + b assigns a value of a + b into c
+= Add AND c += a is equivalent to c = c + a
-= Subtract AND c -= a is equivalent to c = c – a
*= Multiply AND c *= a is equivalent to c = c * a
/= Divide AND c /= a is equivalent to c = c / ac /= a is equivalent to c = c / a
%= Modulus AND c %= a is equivalent to c = c % a
**= Exponent AND c **= a is equivalent to c = c ** a
//= Floor Division c //= a is equivalent to c = c // a

7. Logical Operators

These operators are used to perform similar operations as that of logical gates; there are 3 types of logical operators in python.

Operator Description Syntax Output
and Logical AND a and b a condition is true if both a and b are true
or Logical OR a or b a condition is true if either a and b are true
not Logical NOT not a Complement the operand

Python Operators are the backbone of any operations and functions in the programming context.

Grab the opportunity to learn Python with Entri! Click Here

Assignment Operators in Python

1: Which of the following data types is immutable in Python?

2: What does the len() function do in Python?

3: Which keyword is used to define a function in Python?

4: What will print(type([1, 2, 3])) output?

5: Which statement is correct about Python indentation?

    Fill out the form to see the results

    Ever wondered how much you really know? It's time to put your brain to the test!

    Operators are used to perform operations on values and variables. These are the special symbols that carry out arithmetic, logical, bitwise computations. The value the operator operates on is known as Operand.

    Here, we will cover Assignment Operators in Python. So, Assignment Operators are used to assigning values to variables.

    Operator Description

    Syntax
    = Assign value of right side of expression to left side operand x = y + z
    += Add and Assign: Add right side operand with left side operand and then assign to left operand a += b
    -= Subtract AND: Subtract right operand from left operand and then assign to left operand: True if both operands are equal a -= b
    *= Multiply AND: Multiply right operand with left operand and then assign to left operand a *= b
    /= Divide AND: Divide left operand with right operand and then assign to left operand a /= b
    %= Modulus AND: Takes modulus using left and right operands and assign result to left operand a %= b
    //= Divide(floor) AND: Divide left operand with right operand and then assign the value(floor) to left operand a //= b
    **= Exponent AND: Calculate exponent(raise power) value using operands and assign value to left operand a **= b
    &= Performs Bitwise AND on operands and assign value to left operand a &= b
    |= Performs Bitwise OR on operands and assign value to left operand a |= b
    ^= Performs Bitwise xOR on operands and assign value to left operand a ^= b
    >>= Performs Bitwise right shift on operands and assign value to left operand a >>= b
    <<= Performs Bitwise left shift on operands and assign value to left operand a <<= b

    Now Let’s see each Assignment Operator one by one.

    1) Assign: This operator is used to assign the value of the right side of the expression to the left side operand.

    Syntax:

    x = y + z
    

    Example:

    • Python3
    # Assigning values using 
    # Assignment Operator
     
    a = 3
    b = 5
     
    c = a + b
     
    # Output
    print(c)

    Output:

    8
    

    2) Add and Assign: This operator is used to add the right side operand with the left side operand and then assigning the result to the left operand.

    Syntax: 

    x += y
    

    Example:

    • Python3
    a = 3
    b = 5
     
    # a = a + b
    a += b
     
    # Output
    print(a)

    Output:

    8
    

    3) Subtract and Assign: This operator is used to subtract the right operand from the left operand and then assigning the result to the left operand.

    Syntax:

    x -= y

    Example –

    • Python3

     

    a = 3
    b = 5
     
    # a = a - b
    a -= b
     
    # Output
    print(a)

    Output:

    -2
    

     4) Multiply and Assign: This operator is used to multiply the right operand with the left operand and then assigning the result to the left operand.

    Syntax:

    x *= y
    

    Example:

    • Python3

     

    a = 3
    b = 5
     
    # a = a * b
    a *= b
     
    # Output
    print(a)

    Output:

    15
    

     5) Divide and Assign: This operator is used to divide the left operand with the right operand and then assigning the result to the left operand.

    Syntax: 

    x /= y
    

    Example:

    • Python3

     

     

     

    a = 3
    b = 5
     
    # a = a / b
    a /= b
     
    # Output
    print(a)

    Output:

    0.6
    

     6) Modulus and Assign: This operator is used to take the modulus using the left and the right operands and then assigning the result to the left operand.

    Syntax:

    x %= y
    

    Example:

    • Python3
    a = 3
    b = 5
     
    # a = a % b
    a %= b
     
    # Output
    print(a)

    Output:

    3
    

    7) Divide (floor) and Assign: This operator is used to divide the left operand with the right operand and then assigning the result(floor) to the left operand.

    Syntax:

    x //= y
    

    Example:

    • Python
    a = 3
    b = 5
     
    # a = a // b
    a //= b
     
    # Output
    print(a)

    Output:

    0
    

     8) Exponent and Assign: This operator is used to calculate the exponent(raise power) value using operands and then assigning the result to the left operand.

    Syntax:

    x **= y
    

    Example:

    • Python
    a = 3
    b = 5
     
    # a = a ** b
    a **= b
     
    # Output
    print(a)

    Output:

    243
    

    9) Bitwise AND and Assign: This operator is used to perform Bitwise AND on both operands and then assigning the result to the left operand.

    Syntax:

    x &= y
    

    Example:

    • Python3
    a = 3
    b = 5
     
    # a = a & b
    a &= b
     
    # Output
    print(a)

    Output:

    1
    

    10) Bitwise OR and Assign: This operator is used to perform Bitwise OR on the operands and then assigning result to the left operand.

    Syntax:

    x |= y
    

    Example:

    • Python3
    a = 3
    b = 5
     
    # a = a | b
    a |= b
     
    # Output
    print(a)

    Output:

    7
    

    11) Bitwise XOR and Assign: This operator is used to perform Bitwise XOR on the operands and then assigning result to the left operand.

    Syntax:

    x ^= y
    

    Example:

    • Python3
    a = 3
    b = 5
     
    # a = a ^ b
    a ^= b
     
    # Output
    print(a)

    Output:

    6
    

    12) Bitwise Right Shift and Assign: This operator is used to perform Bitwise right shift on the operands and then assigning result to the left operand.

    Syntax:

    x >>= y
    

    Example:

    • Python3
    a = 3
    b = 5
     
    # a = a >> b
    a >>= b
     
    # Output
    print(a)

    Output:

    0
    

     13) Bitwise Left Shift and Assign: This operator is used to perform Bitwise left shift on the operands and then assigning result to the left operand.

    Syntax:

    x <<= y
    

    Example:

    • Python3
    a = 3
    b = 5
     
    # a = a << b
    a <<= b
     
    # Output
    print(a)

    Output:

    96
    
    

    Learn to code from industry experts! Enroll here

    🚀 Start Coding Today! Enroll Now with Easy EMI Options. 💳✨

    Gain expertise in Django and open doors to lucrative opportunities in web development.

    Start Learning With EMI Payment Options

    Python Relational Operators

    A relational operator is used to compare two values. Based on the operator and values, the operator returns either True or False.

    In Python, there are six Relational Operators. They are

    Symbol Name Example Description
    == Equal to x == y Returns True if x and y have same value, else returns False.
    > Greater than x > y Returns True if value of x is greater than value of y, else returns False.
    < Less than x < y Returns True if value of x is less than value of y, else returns False.
    != Not equal to x != y Returns True if x and y do not have same value, else returns False.
    >= Greater than or equal to x >= y Returns True if value of x is greater than or equal to value of y, else returns False. Equivalent to ( x>y or x==y )
    <= Less than or equal to x <= y Returns True if value of x is less than or equal to value of y, else returns False. Equivalent to ( x>y or x==y )

    Equal to Operator

    Equal to operator == takes two operands and returns boolean value of True, if both the operands are equal in value, else it returns False.

    In the following example, we will take two integer values such than both are equal in value, and check the result of equal to operator with these two integers provided as operands to the equal to operator.

    Python Program

    x = 41
    y = 41
    result = x == y
    print(result)
     Run

    Output

    True

    In the following example, we will take two integer values such than both are not equal in value, and check the result of equal to operator with these two integers provided as operands to the equal to operator.

    Python Program

    x = 41
    y = 63
    result = x == y
    print(result)
     Run

    Output

    False

    Greater than Operator

    Greater than operator > takes two operands and returns boolean value of True, if the left operand is greater than the right operand in value, else it returns False.

    In the following example, we will take two integer values such that left operand is greater than the right operand, and check the result of greater than operator.

    Python Program

    x = 87
    y = 63
    result = x > y
    print(result)
     Run

    Output

    True

    In the following example, we will take two integer values such that left operand is less than the right operand, and check the result of greater than operator.

    Python Program

    x = 41
    y = 63
    result = x > y
    print(result)
     Run

    Output

    False

    Less than Operator

    Less than operator < takes two operands and returns boolean value of True, if the left operand is less than the right operand in value, else it returns False.

    In the following example, we will take two integer values such that left operand is less than the right operand, and check the result of less than operator.

    Python Program

    x = 41
    y = 63
    result = x < y
    print(result)
     Run

    Output

    True

    In the following example, we will take two integer values such that left operand is greater than the right operand, and check the result of less than operator.

    Python Program

    x = 92
    y = 63
    result = x < y
    print(result)
     Run

    Output

    False

    Not Equal to Operator

    Not Equal to operator != takes two operands and returns boolean value of True, if both the operands are not equal in value, else it returns False.

    In the following example, we will take two integer values such that both are not equal in value, and check the result of not equal to operator with these two integers provided as operands to the not equal to operator.

    Python Program

    x = 92
    y = 63
    result = x != y
    print(result)
     Run

    Output

    True

    In the following example, we will take two integer values such that both are equal in value, and check the result of not equal to operator with these two integers provided as operands to the not equal to operator.

    Python Program

    x = 63
    y = 63
    result = x != y
    print(result)
     Run

    Output

    False

    Greater than or Equal to Operator

    Greater than or Equal to operator >= takes two operands and returns boolean value of True, if the left operand is greater than or equal to the right operand in value, else it returns False.

    In the following example, we will take two integer values such that left operand is greater than or equal to the right operand, and check the result of greater than or equal to operator.

    Learn Coding in your Language! Enroll Here!

    Python Program

    x = 97
    y = 63
    result = x >= y
    print(result)
     Run

    Output

    True

    In the following example, we will take two integer values such that left operand is less than the right operand, and check the result of greater than or equal to operator.

    Python Program

    x = 42
    y = 63
    result = x >= y
    print(result)
     Run

    Output

    False

    Less than or Equal to Operator

    Less than or Equal to operator <= takes two operands and returns boolean value of True, if the left operand is less than or equal to the right operand in value, else it returns False.

    In the following example, we will take two integer values such that left operand is less than the right operand, and check the result of less than or equal to operator.

    Python Program

    x = 42
    y = 63
    result = x <= y
    print(result)
     Run

    Output

    True

    In the following example, we will take two integer values such that left operand is greater than the right operand, and check the result of less than or equal to operator.

    Python Program

    x = 92
    y = 63
    result = x <= y
    print(result)
     Run

    Output

    False

    Python Arithmetic Operators

    Python and Machine Learning Square

    Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication and division.

    There are 7 arithmetic operators in Python :

    1. Addition
    2. Subtraction
    3. Multiplication
    4. Division
    5. Modulus
    6. Exponentiation
    7. Floor division

    1. Addition Operator : In Python, + is the addition operator. It is used to add 2 values.
    Example :

    val1 = 2
    val2 = 3
     
    # using the addition operator
    res = val1 + val2
    print(res)

    Output :

    5

    2. Subtraction Operator : In Python, – is the subtraction operator. It is used to subtract the second value from the first value.
    Example :

    val1 = 2
    val2 = 3
     
    # using the subtraction operator
    res = val1 - val2
    print(res)

    Output :

    -1

    3. Multiplication Operator : In Python, * is the multiplication operator. It is used to find the product of 2 values.
    Example :

    val1 = 2
    val2 = 3
     
    # using the multiplication operator
    res = val1 * val2
    print(res)

    Output :

    6

    4. Division Operator : In Python, / is the division operator. It is used to find the quotient when first operand is divided by the second.
    Example :

    val1 = 3
    val2 = 2
     
    # using the division operator
    res = val1 / val2
    print(res)

    Output :

    1.5

    5. Modulus Operator : In Python, % is the modulus operator. It is used to find the remainder when first operand is divided by the second.
    Example :

    val1 = 3
    val2 = 2
     
    # using the modulus operator
    res = val1 % val2
    print(res)

    Output :

    1

    6. Exponentiation Operator : In Python, ** is the exponentiation operator. It is used to raise the first operand to power of second.
    Example :

    val1 = 2
    val2 = 3
     
    # using the exponentiation operator
    res = val1 ** val2
    print(res)

    Output :

    8

    7. Floor division : In Python, // is used to conduct the floor division. It is used to find the floorof the quotient when first operand is divided by the second.
    Example :

    val1 = 3
    val2 = 2
     
    # using the floor division
    res = val1 // val2
    print(res)

    Output :

    1

    Below is the summary of all the 7 operators :

    Operator Description Syntax
    + Addition: adds two operands x + y
    – Subtraction: subtracts two operands x – y
    * Multiplication: multiplies two operands x * y
    / Division (float): divides the first operand by the second x / y
    // Division (floor): divides the first operand by the second x // y
    % Modulus: returns the remainder when first operand is divided by the second x % y
    ** Power : Returns first raised to power second x ** y

    Learn Coding in your Language! Enroll Here!

    Share62SendShare

    Feeba Mahin

    Related Posts

    15 Best Design Books Every UI/UX Professional Should Read
    Articles

    15 Best Design Books Every UI/UX Professional Should Read

    May 15, 2025
    Highest Paying Countries for MEP Quantity Surveyors
    Articles

    Highest Paying Countries for MEP Quantity Surveyors

    May 15, 2025
    Skechers Marketing Strategy
    Articles

    Skechers Marketing Strategy

    May 15, 2025
    Next Post
    Natural Vegetation in India- Type, Characteristics

    Natural Vegetation in India- Type, Characteristics

    More to Explore

    1. Future of Python Developers
    2. Python Online Course with 100% Placement
    3. Steps To Code A Video Conferencing App Using Python
    4. Python Advanced Interview Questions and Answers
    5. Introduction to Data Visualization in Python
    6. Python developer – Skills, Courses, Job Roles
    7. Python Developer Salary in India
    8. Method Overloading in Python

    Practice Programs

    1. Program for Finding Factorial of a Number in Python
    2. Python Program to Convert Decimal to Binary Number
    3. Python Program for Fibonacci Series
    4. Prime Number Program in Python
    5. Python Program to Check Armstrong Number

    Python Training in Different Cities

    1. Python Training in Kochi
    2. Python Training in Trivandrum
    3. Python Training in Calicut

    Free Tutorials For You

    1. SQL Tutorial for Beginners PDF
    2. Python Tutorial for Beginners in Hindi
    3. GIT and GITHUB Tutorial for Beginners in Hindi
    4. HTML Exercises to Practice
    5. JavaScript Tutorial in Tamil
    6. DSA Practice Series
    7. Microsoft Excel Malayalam Tutorial
    8. Learn Bootstrap in Tamil
    9. Introduction to CSS in Malayalam
    10. Introduction to JavaScript in Malayalam
    11. Java Programming Notes PDF
    12. Introduction to HTML in Malayalam

    Courses

    • Data Science Course
    • Full Stack Developer Course
    • Software Testing Course
    • Data Science Course in Malayalam
    • Full Stack Developer Course in Malayalam
    • Full Stack Developer Course in Hindi
    • Full Stack Developer Course in Tamil
    • Full Stack Developer Course in Telugu
    • Full Stack Developer Course in Kannada
    • Python Programming Course
    • Practical Accounting Course
    • Structural Design Course
    • Quantity Surveying Course
    • Embedded Systems Course in Kerala
    • BIM Course
    • MEP Course
    • MEP QS Course
    • Stock Market Course
    • Stock Market Course in Malayalam
    • Stock Market Course in Tamil
    • Stock Market Course in Kannada
    • Forex Trading Course
    • Mutual Funds Course
    • PwC Edge : Strategic Accounting and Finance Programme
    • SAP FICO Training
    • SAP MM Training
    • SAP SD Training
    • ACCA Online Course
    • HR Management Course

    Company

    • Become a teacher
    • Login to Entri Web

    Spoken English Courses

    • Spoken English Course
    • Spoken English Course in Malayalam
    • Spoken English Course in Hindi
    • Spoken English Course in Tamil
    • Spoken English Course in Telugu
    • Spoken English Course in Kannada
    • Spoken English Course for Housewives
    • Spoken English Course for Working Professionals
    • Spoken English Course for School Students
    • Spoken English Course for College Students
    • Spoken English Course for Job Seekers
    • AI Powered Spoken English Course

    Quick Links

    • Explore Free Courses
    • Aptitude Questions
    • Articles
    • Videos
    • Entri Daily Quiz Practice
    • Current Affairs & GK
    • News Capsule – eBook
    • Preparation Tips
    • Kerala PSC Gold
    • Entri Skilling
    • Kerala PSC

    Other Courses

    • OET Coaching Classes
    • DHA Course
    • Nurse Recruitment Abroad
    • Montessori Teachers Training
    • Performance Marketing Course
    • German Language Course
    • Yoga Teacher Training Course
    • Digital Marketing Course
    • Options Trading Course
    • German Language A1 Course
    • German Language A2 Course
    • German Language B1 Course
    • German Language B2 Course
    • Diploma in Early Childhood Care and Education
    • Hospital and Healthcare Administration
    • Business Administration & Hospital Management
    • Hospital and Healthcare Administration

    Popular Exam

    • IBPS Exam
    • SBI Exam
    • Railway RRB Exam
    • Kerala PSC
    • Tamil Nadu PSC
    • Telangana PSC
    • Andhra Pradesh PSC
    • MPPSC
    • UPPSC
    • Karnataka PSC
    • Staff Selection Commission Exam
    • GATE

    © 2023 Entri.app - Privacy Policy | Terms of Service

    No Result
    View All Result
    • Kerala PSC
      • Kerala PSC General
        • Kerala PSC Exams
        • KAS Exam
        • Kerala PSC VEO Notification
        • Kerala Police SI
        • Kerala PSC LDC Notification
        • Kerala PSC Village Field Assistant Notification
        • Kerala PSC LD Typist Notification
        • Kerala PSC Food Safety Officer
        • Kerala PSC Excise Inspector Notification
        • Kerala PSC BDO Notification
        • Kerala PSC CPO Notification
        • Kerala PSC LGS Notification
        • Fire and Rescue Officer
        • Women Fire and Rescue Officer
      • Kerala PSC Teaching
        • Kerala PSC HSA
        • Kerala PSC HSST
        • KTET
        • LP/UP Assistant
        • KVS
        • Railway Teacher
      • Kerala PSC Technical
        • LSGD AE
        • Draftsman/Overseer
        • IEO
        • ATP
        • Polytechnic Lecturer
        • AE Electronics
        • Assistant Engineer
    • Banking
      • IBPS PO Notification
      • IBPS Clerk Notification
      • SBI PO Notification
      • SBI Clerk Notification
      • SBI SO Notification
      • SBI Apprentice Notification
      • Canara Bank PO Notification
      • Indian Bank PO Notification
      • RBI Assistant Notification
      • RBI Office Attendant Notification
      • IBPS RRB Notification
      • IBPS RRB Office Assistant Notification
    • Skilling
      • Coding
      • Spoken English
      • Stock Market
        • Share Market Today News
        • Share Market Analysis
      • Digital Marketing
      • Accounting Course
      • SAP
      • OET
      • German
      • IELTS
      • Quantity Survey
      • MEP
      • Structural Design
      • Montessori
      • Yoga Teaching
      • Oil and Gas
    • Courses
      • Data Science Course
        • Data Science Malayalam
        • Data Science Course in Tamil
        • Data Science Course in Telugu
        • Data Science Training in Kochi
        • Data Science Training in Trivandrum
        • Data Science Course in Calicut
        • Data Science Training in Thrissur
      • Data Analytics Course
        • Data Analytics Course in Malayalam
        • Data Analytics Course in Tamil
        • Data Analytics Course in Telugu
      • Technical Upskilling
        • Quantity Surveying Course
        • Structural Design Course
        • BIM Course in Kerala
        • MEP Course
        • Embedded System Course
        • MEP Quantity Surveying Course
        • MEP Course in Kochi
        • Quantity Surveyor Course in Tamil
        • Quantity Surveying Course in Telugu
        • Quantity Surveyor Course in Hyderabad
        • Quantity Surveying Course in Chennai
        • MEP Design Course in Kerala
        • HVAC Course
        • Steel Structure Design Course
        • RCC Design Course
      • Full Stack Developer Course
        • Full Stack Development Malayalam
        • Full Stack Development Hindi
        • Full Stack Development Tamil
        • Full Stack Development Telugu
        • Full Stack Development Kannada
      • Stock Market Course
        • Stock Market Course in Malayalam
        • Stock Market Course in Tamil
        • Stock Market Course in Kannada
        • Options Trading Course
      • Mutual Funds Course
      • Forex Trading Course
      • Spoken English Course
        • Spoken English Course in Malayalam
        • Spoken English Course in Hindi
        • Spoken English Course in Telugu
        • Spoken English Course in Tamil
        • Spoken English Course in Kannada
      • Python Programming Course
      • Software Testing Course
        • Software Testing Course in Malayalam
        • Software Testing Course in Tamil
        • Software Testing Course in Telugu
      • AWS Solutions Architect Associate Course
      • PwC Edge : Strategic Accounting and Finance Programme
      • Practical Accounting Course
        • Accounting Course in Malayalam
        • Accounting Course in Tamil
        • Tally Course
        • Taxation Course
        • UAE Accounting
        • GST Course
        • Zoho Books Training
        • GST Practitioner Course in Kerala
        • GCC VAT Course
      • ACCA Training Online
        • ACCA Course in Kerala
      • SAP Training Courses
        • SAP FICO Course
        • SAP MM Course
        • SAP SD Training
        • SAP FICO Course in Tamil
        • SAP MM Course in Tamil
      • HR Management Course
      • Performance Marketing Course
      • Mern Stack Developer Course
        • Full Stack Developer Course in Kochi
        • Full Stack Developer Course in Trivandrum
        • Full Stack Developer Course in Calicut
        • Full Stack Developer Course in Pune
        • Full Stack Developer Course in Bangalore
        • Full Stack Developer Course in Hyderabad
        • Full Stack Developer Course in Chennai
        • Full Stack Developer Course in Indore
        • Full Stack Developer Course in Jaipur
        • Full Stack Developer Course in Coimbatore
      • Digital Marketing Training
        • Digital Marketing Course in Kochi
        • Digital Marketing Course in Trivandrum
        • Digital Marketing Course in Calicut
        • Digital Marketing Course in Kollam
        • Digital Marketing Course in Thrissur
        • Digital Marketing Course in Kottayam
        • Digital Marketing Course in Kannur
      • Montessori Teacher Training
        • Montessori Teacher Training in Calicut
        • Montessori Teacher Training in Kochi, Ernakulam
        • Montessori Teacher Training in Trivandrum
        • Montessori Teacher Training in Kollam
        • Montessori Teacher Training in Malayalam
        • Montessori Teacher Training in Kannada
      • Other Courses
        • German Language Course
        • OET Coaching
        • DHA Course
        • MOH Exam Coaching
        • Nurses Recruitment Abroad
        • FMGE Coaching
        • ChatGPT Course
        • Forex Trading Course
        • Yoga Teacher Training Course
        • Diploma in Early Childhood Care and Education
        • Business Administration & Hospital Management Course
        • Hospital and Healthcare Administration
        • AI for Teachers Course
    • Others
      • Railway
        • RRB Technician Notification
        • RRB JE Notification
        • RRB ALP Notification
        • RRB NTPC Notification
        • RRB RPF Notification
        • RRB RPF SI Notification
        • RRB RPF Constable Notification
        • RRB Group D Notification
        • RRB RPSF SI Notification
        • RRB SSE Notification
      • SSC
        • SSC CPO Notification
        • SSC MTS Notification
        • SSC CGL Notification
        • SSC CHSL Notification
        • SSC GD Constable Notification
        • SSC Stenographer Notification
        • SSC JE Notification
        • SSC CAPF Notification
        • SSC JHT Notification
        • Delhi Police Constable Notification
        • Delhi Police SI Notification
      • GATE
      • MAT
      • KMAT
        • KMAT Kerala 2024
      • TET
        • APTET
        • CTET
        • DSSSB
        • Karnataka TET
        • Kerala TET
        • KVS
        • MPTET
        • SUPER TET
        • TNTET
        • TSTET
        • UPTET
      • UPSC
        • UPSC CAPF Notification
        • UPSC CDS Notification
        • UPSC NDA Notification
        • UPSC Civil service Notification
    • Free Learn
      • Free Courses
        • Free Coding Courses
        • Free Accounting Courses
        • Free Digital Marketing Courses
        • Engineering Upskilling Courses
        • Free Hospital Administration Courses
        • Free OET Training
        • Free SAP Courses
        • Free Teachers Training Courses
        • Free Trading Courses
      • Question Answer
      • Aptitude Questions
      • Webinars
    • Test Prep
      • Kerala PSC Coaching
        • KPSC Degree Level Exam Preparation
        • Kerala PSC 12th Level Exam Preparation
        • Kerala PSC 10th Level Exam Preparation
        • KAS Coaching
        • Kerala PSC LDC Coaching
        • Kerala PSC LD Typist Coaching
        • Kerala PSC Fireman Coaching
        • KSFE Assistant Exam Preparation
        • Secretariat Office Attendant Coaching
        • Secretariat Assistant Coaching
        • Kerala PSC SI Exam Coaching
        • Khadi Board LDC Exam Preparation
        • Devaswom Board LDC Coaching
        • University LGS Exam Preparation
        • University Assistant Exam Coaching
        • KPSC Scientific Officer Exam Coaching
        • KPSC Probation Officer Grade II
        • KPSC Food Safety Officer Coaching
        • KWA Sanitary Chemist Coaching
        • KPSC Diary Farm Instructor Exam Coaching
        • Kerala PSC KWA Lab Assistant Exam Coaching
        • Kerala PSC ICDS Supervisor Exam Coaching
        • KPSC Finger Print Searcher Coaching
        • Kerala PSC Welfare Officer Gr. II Exam Coaching
        • KPSC Assistant Dental Surgeon Coaching
      • KPSC Teaching Exams
        • HSA Exam Preparation
        • KPSC HSA Social Science Coaching
        • KPSC HSA Physical Science Coaching
        • KPSC HSA English Coaching
        • KPSC Junior Language Teacher Hindi
        • KTET Coaching
        • SET Coaching
        • LP/UP Assistant Exam Coaching
        • HSST Exam Preparation
        • HSST Commerce Exam Coaching
        • Kerala PSC Lecturer in Diet Coaching
        • KVS PGT/TGT Coaching
      • Kerala PSC Technical Exams Coaching
        • Assistant Engineer Electrical Exam Coaching
        • Assistant Engineer Electronics Coaching
        • Assistant Engineer Mechanical Coaching
        • Kerala PSC Industries Extension Officer Coaching
        • KPSC LSGD AE Exam Coaching
        • KPSC Civil Engineering Exam Coaching
        • KPSC Mechanical Engineering Exam Coaching
        • KPSC Electrical Engineering Exam Coaching
        • KPSC Electronics Engineering Exam Coaching
        • KPSC Technical Computer Science Coaching
        • KPSC Tradesman Turning Coaching
        • Kerala PSC Overseer Exam Coaching
        • KPSC Assistant Town Planner Coaching
        • Lecturer in Polytechnic Electronics Coaching
      • Teaching Exams Coaching
        • CSIR NET Exam Coaching
        • EMRS Coaching
        • CTET Exam Online Coaching
      • IELTS Training Online
      • Bank Exam Coaching Online
        • SEBI Grade A Coaching
        • IBPS SO Online Coaching
        • IBPSC PO Online Coaching
        • IBPSC Clerk Online Coaching
        • SBI PO Coaching
        • SBI Clerk Online Coaching
        • SBI Apprentice Class
        • SBI SO Online Coaching
        • RBI Grade B Coaching
        • RBI Assistant Coaching
        • CSEB Exam Coaching
        • IBPS RRB Coaching
        • IBPS RRB PO Coaching
        • Canara Bank Po Exam Coaching
        • Kerala Gramin Bank Coaching
        • Kerala Bank Exam Coaching
        • JCI Exam Coaching
        • NABARD Grade A Coaching
        • LIC AAO Coaching Online
      • UPSC Online Coaching
        • UPSC CAPF Online Coaching
      • SSC Online Coaching
        • SSC JE Online Coaching
        • SSC CGL Coaching
        • SSC CGL AAO Coaching
        • SSC CGL CBI Inspector Coaching
        • SSC CHSL Coaching
        • SSC MTS Coaching
        • SSC Stenographer Coaching
        • SSC GD Online Coaching
      • RRB Exams Coaching
        • RRB RPF Exam Coaching
        • RRB NTPC Exam Coaching
        • RRB JE Online Coaching
        • RRB JE Electronics Coaching
        • RRB ALP Exam Coaching
        • RRB Technician Exam Coaching
      • CAT Online Coaching
      • CMAT Online Coaching
      • XAT Exam Coaching
      • GATE Online Coaching
        • GATE CE Online Coaching
        • GATE ME Online Coaching
        • GATE EE Online Coaching
      • NMAT Exam Coaching
      • AAI ATC Jr Executive Coaching
      • Cochin Shipyard Executive Trainee Coaching
      • BEL Probationary Engineer Coaching
      • HPCL Junior Executive Coaching

    © 2023 Entri.app - Privacy Policy | Terms of Service

    Chat