Python bitwise shift right is done with the >>
operator. x >>
y, will shift x by y places to the right at the bit level.
>>> 38 >> 2
9
As you can see below 152 is binary 38 shifted two 0s to the left
38 = 00000000 00000000 00000000 00100110
>> 2 = 00000000 00000000 00000000 00001001 = 9
Bitwise shift left can only be done with integers
>>> 38.2 >> 5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for >>: 'float' and 'int'