Python Operators and Built-in Functions - Cheat Sheet
1. Arithmetic Operators
+ : Addition (e.g., a + b)
- : Subtraction (e.g., a - b)
* : Multiplication (e.g., a * b)
/ : Division (e.g., a / b)
// : Floor Division (e.g., a // b)
% : Modulus (e.g., a % b)
** : Exponentiation (e.g., a ** b)
2. Relational (Comparison) Operators
== : Equal to (a == b)
!= : Not equal to (a != b)
> : Greater than (a > b)
< : Less than (a < b)
>= : Greater than or equal to (a >= b)
<= : Less than or equal to (a <= b)
3. Logical Operators
and : Logical AND (a and b)
or : Logical OR (a or b)
not : Logical NOT (not a)
4. Bitwise Operators
& : Bitwise AND (a & b)
| : Bitwise OR (a | b)
^ : Bitwise XOR (a ^ b)
~ : Bitwise NOT (~a)
<< : Left Shift (a << 2)
>> : Right Shift (a >> 2)
Python Operators and Built-in Functions - Cheat Sheet
5. Assignment Operators
= : Assign (a = b)
+= : Add and assign (a += b)
-= : Subtract and assign (a -= b)
*= : Multiply and assign (a *= b)
/= : Divide and assign (a /= b)
//= : Floor divide and assign (a //= b)
%= : Modulus and assign (a %= b)
**= : Exponentiate and assign (a **= b)
&= : Bitwise AND and assign
|= : Bitwise OR and assign
^= : Bitwise XOR and assign
<<= : Left shift and assign
>>= : Right shift and assign
6. Membership and Identity Operators
in : True if value in sequence (x in y)
not in : True if value not in sequence
is : True if same object (x is y)
is not : True if not same object
7. Unary Operators
+ : Unary plus
- : Unary minus
not : Logical NOT
~ : Bitwise NOT
8. Python Built-in Functions (Common)
print(), input(), len(), type(), str(), int(), float()
list(), dict(), set(), tuple(), range(), zip()
Python Operators and Built-in Functions - Cheat Sheet
max(), min(), sum(), abs(), round(), sorted()
all(), any(), dir(), help(), eval(), exec()
enumerate(), map(), filter(), reduce() (from functools)