What is right shift (>>) operator in Python?

PythonServer Side ProgrammingProgramming

In Python >> is called right shift operator. It is a bitwise operator. It requires a bitwise representation of object as first operand. Bits are shifted to right by number of bits stipulated by second operand. Leading bits as towards left as a result of shifting are set to 0.

>>> bin(a)     #binary equivalent 0110 0100
>>> b=a>>2     #binary equivalent 0001 1101
>>> b
>>> bin(b)
Published on 13-Feb-2018 13:49:13