Python Operators

📘 Python 👁 74 views 📅 Nov 05, 2025
⏱ Estimated reading time: 2 min

Python Operators

Python operators are special symbols used to perform operations on variables and values. They are classified into several types.


1. Arithmetic Operators

OperatorDescriptionExampleResult
+Addition5 + 38
-Subtraction5 - 32
*Multiplication5 * 315
/Division5 / 22.5
//Floor Division5 // 22
%Modulus5 % 21
**Exponentiation2 ** 38

2. Assignment Operators

OperatorDescriptionExample
=Assign valuex = 5
+=Add and assignx += 3x = x + 3
-=Subtract and assignx -= 2x = x - 2
*=Multiply and assignx *= 3x = x * 3
/=Divide and assignx /= 2x = x / 2
//=Floor divide and assignx //= 2
%=Modulus and assignx %= 3
**=Exponent and assignx **= 2

3. Comparison Operators

OperatorDescriptionExampleResult
==Equal to5 == 5True
!=Not equal to5 != 3True
>Greater than5 > 3True
<Less than5 < 3>False
>=Greater than or equal5 >= 5True
<=Less than or equal5 <= 3False

4. Logical Operators

OperatorDescriptionExampleResult
andReturns True if both are TrueTrue and FalseFalse
orReturns True if any is TrueTrue or FalseTrue
notReturns inversenot TrueFalse

5. Bitwise Operators

OperatorDescriptionExampleResult
&AND5 & 31
``OR`5
^XOR5 ^ 36
~NOT~5-6
<<Left shift5 << 1>10
>>Right shift5 >> 12

6. Membership Operators

OperatorDescriptionExampleResult
inReturns True if value exists'a' in 'Python'False
not inReturns True if value does not exist'a' not in 'Python'True

7. Identity Operators

OperatorDescriptionExampleResult
isReturns True if both are the same objectx is yDepends
is notReturns True if both are not the same objectx is not yDepends

8. Key Points

  • Arithmetic operators handle math calculations.

  • Assignment operators update variable values.

  • Comparison operators are used in conditions.

  • Logical operators combine boolean expressions.

  • Bitwise operators work on binary values.

  • Membership and identity operators check existence and object identity.


🔒 Some advanced sections are available for Registered Members
Register Now

Share this Post


← Back to Tutorials

Popular Competitive Exam Quizzes