Python Operators - Class 11 & 12 (NCERT)
1. Arithmetic Operators
Operator Meaning Example
+ Addition 5+3=8
- Subtraction 5-3=2
* Multiplication 5 * 3 = 15
/ Division 5 / 2 = 2.5
// Floor Division 5 // 2 = 2
% Modulus 5%2=1
** Exponentiation 2 ** 3 = 8
2. Relational (Comparison) Operators
Operator Meaning Example
== Equal to 5 == 5 -> True
!= Not equal to 5 != 3 -> True
> Greater than 5 > 3 -> True
< Less than 5 < 3 -> False
>= Greater than or equal 5 >= 5 -> True
<= Less than or equal 5 <= 3 -> False
3. Logical Operators
Operator Meaning Example
and Logical AND True and False -> False
or Logical OR True or False -> True
not Logical NOT not True -> False
4. Assignment Operators
Operator Meaning Example
= Assign x=5
+= Add and assign x += 2 -> x = x + 2
Python Operators - Class 11 & 12 (NCERT)
-= Subtract and assign x -= 2
*= Multiply and assign x *= 2
/= Divide and assign x /= 2
//= Floor divide and assign x //= 2
%= Modulus and assign x %= 2
**= Exponent and assign x **= 2
5. Bitwise Operators
Operator Meaning Example
& Bitwise AND 5 & 3 -> 1
| Bitwise OR 5 | 3 -> 7
^ Bitwise XOR 5 ^ 3 -> 6
~ Bitwise NOT ~5 -> -6
<< Left Shift 5 << 1 -> 10
>> Right Shift 5 >> 1 -> 2
6. Identity Operators
Operator Meaning Example
is True if both refer to same object x is y
is not True if not same object x is not y
7. Membership Operators
Operator Meaning Example
in True if value found 'a' in 'abc' -> True
not in True if value not found 'd' not in 'abc' -> True
Operator Precedence (Highest to Lowest)
1. ()
2. **
Python Operators - Class 11 & 12 (NCERT)
3. Unary +, -
4. *, /, //, %
5. +, -
6. <, <=, >, >=
7. ==, !=
8. not
9. and
10. or
11. Assignment (=, +=, etc.)