Operators_in_Python
Operators_in_Python
1. Arithmetic Operators:
Examples:
Addition: 5 + 3 -> 8
Subtraction: 5 - 3 -> 2
Multiplication: 5 * 3 -> 15
Modulus: 5 % 3 -> 2
2. Comparison Operators:
Examples:
3. Logical Operators:
Examples:
4. Assignment Operators:
Examples:
x = 5 -> Assigns 5 to x
x += 3 -> x = x + 3 -> 8
x -= 3 -> x = x - 3 -> 5
x *= 3 -> x = x * 3 -> 15
x %= 3 -> x = x % 3 -> 2
5. Bitwise Operators:
Examples:
6. Membership Operators:
Examples:
7. Identity Operators:
Examples:
x = [1, 2, 3]
y=x
x is y -> True
8. Ternary Operator:
Example:
x=5
y=3
Output: Greater