Cheatography
https://cheatography.com
Python Arithmetic Operators
Addition |
|
|
Subtraction |
|
|
Multiplication |
|
|
Division |
|
|
Modulus |
|
|
Exponentiation |
|
|
Floor division |
|
|
Python Assignment Operators
Operator |
Example |
Same As |
= |
|
|
+= |
|
|
-= |
|
|
*= |
|
|
/= |
|
|
%= |
|
|
//= |
|
|
**= |
|
|
Python Comparison Operators
Equal |
|
Not equal |
|
Greater than |
|
Less than |
|
Greater than or equal to |
|
Less than or equal to |
|
|
|
Boolean Values
In programming you often need to know if an expression is True
or False
. You can evaluate any expression in Python, and get the answer. |
|
|
|
|
Python Logical Operators
and |
Returns True if both statements are true |
|
or |
Returns True if one of the statements is true |
|
not |
Reverse the result, returns False if the result is true |
|
Python Identity Operators
is |
Returns true if both variables are the same object |
|
is not |
Returns true if both variables are not the same object |
|
|
|
Python Membership Operators
in |
Returns True if a sequence with the specified value is present in the object |
|
not in |
Returns True if a sequence with the specified value is not present in the object |
|
Python Bitwise Operators
|
AND |
Sets each bit to 1 if both bits are 1 |
|
OR |
Sets each bit to 1 if one of two bits is 1 |
|
XOR |
Sets each bit to 1 if only one of two bits is 1 |
|
NOT |
Inverts all the bits |
|
Zero fill left shift |
Shift left by pushing zeros in from the right and let the leftmost bits fall off |
|
Signed right shift |
Shift right by pushing copies of the leftmost bit in from the left, and let the rightmost bits fall off |
|
Created By
Metadata
Favourited By
Comments
srcorazoncito, 04:43 30 May 22
nice codesheat,continue like that!!!
srcorazoncito, 04:43 30 May 22
nice codesheat,continue like that!!!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by Nouha_Thabet