What Does the Operator Do in Python



It is a bitwise right shift operator. The bit pattern is shifted towards right by number of places stipulated by operand on right. Bits on left are set to 0

For example a=60 (00111100 in binary), a>>2 will result in 15 (00001111 in binary)

>>> a=60
>>> bin(a)result #39;0b111100'
>>> b=a>>2
>>> bin(b)
'0b1111'
Updated on: 2020-02-26T07:38:32+05:30

398 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements