5/9/26, 2:39 PM Python Operators Overview
operators in python
Fast answer
In Python, operators are special symbols used to perform operations on variables and values. Here’s a clear
breakdown of the main types:
🔢 1. Arithmetic Operators
Used for mathematical operations.
Operator Meaning Example
+ Addition 5 + 2 = 7
- Subtraction 5 - 2 = 3
* Multiplication 5 * 2 = 10
/ Division 5 / 2 = 2.5
// Floor division 5 // 2 = 2
% Modulus (remainder) 5 % 2 = 1
[Link] 1/6
5/9/26, 2:39 PM Python Operators Overview
Operator Meaning Example
** Exponent 5 ** 2 = 25
🔍 2. Comparison Operators
Used to compare values (returns True or False ).
Operator Meaning Example
== Equal 5 == 5 → True
!= Not equal 5 != 2 → True
> Greater than 5 > 2 → True
< Less than 5 < 2 → False
>= Greater or equal 5 >= 5 → True
<= Less or equal 5 <= 2 → False
🧠 3. Logical Operators
Used to combine conditions.
[Link] 2/6
5/9/26, 2:39 PM Python Operators Overview
Operator Meaning Example
and Both true (5>2 and 3>1) → True
or At least one true (5>2 or 3<1) → True
not Reverse result not(5>2) → False
🧮 4. Assignment Operators
Used to assign values.
Operator Example Meaning
= x = 5 Assign
+= x += 2 x = x + 2
-= x -= 2 x = x - 2
*= x *= 2 x = x * 2
/= x /= 2 x = x / 2
🔗 5. Bitwise Operators
Work on binary numbers.
[Link] 3/6
5/9/26, 2:39 PM Python Operators Overview
Operator Meaning
& AND
` `
^ XOR
~ NOT
<< Left shift
>> Right shift
📦 6. Membership Operators
Check if a value exists in a sequence.
Operator Example
in 'a' in "apple" → True
not in 'x' not in "apple" → True
🆔 7. Identity Operators
Check if two variables refer to the same object.
[Link] 4/6
5/9/26, 2:39 PM Python Operators Overview
Operator Example
is x is y
is not x is not y
ChatGPT Share
✅ Example in Code
x = 10
y = 3
Python Run
print(x + y) # arithmetic
print(x > y) # comparison
print(x > 5 and y < 5) # logical
If you want, I can give you practice problems or a cheat sheet PDF-style summary.
[Link] 5/6
5/9/26, 2:39 PM Python Operators Overview
[Link] 6/6