equal x == y
not equal x != y
greater than x > y
less than x < y
greater than or equal x >= y
less than or equal x <= y
and
or
not
object_1 is object_2
This will be True, if both objects are the same object, i.e. object_1 = object_2, but False, even if both only contain the same value! The equality of two variables is compared with ==, but that is not the same as the identity of two objects.
.logical_and() #and in numpy for arrays
.logical_not() #notin numpy for arrays
.logical_or() #or in numpy for arrays
& AND
| OR
^ XOR
~ NOT
<< zero fill left shift
>> zero fill right shift
in
for i in my_list:
print(i)
if x in my_list
"my_key" in my_dictonary
not in
x = 2 ⇔ x = 2
x += 2 ⇔ x = x + 2
x -= 2 ⇔ x = x - 2
x *= 2 ⇔ x = x * 2
x **= 2 ⇔ x = x ** 2
x /= 2 ⇔ x = x / 2
x %= 2 ⇔ x = x % 2
x //= 2 ⇔ x = x // 2
x &= 2 ⇔ x = x & 2 (AND)
x |= 2 ⇔ x = 2 | 2 (OR)
x ^= 2 ⇔ x = x ^ 2 (XOR)
x <<= 2 ⇔ x = x << 2
x >>= 2 ⇔ x = x >> 2