What is vertical bar in Python bitwise assignment operator?

PythonServer Side ProgrammingProgramming

Vertical bar (|) stands for bitwise or operator. In case of two integer objects, it returns bitwise OR operation of two

>>> a=4
>>> bin(a)
'0b100'
>>> b=5
>>> bin(b)
'0b101'
>>> a|b
5
>>> c=a|b
>>> bin(c)
'0b101'
raja
Published on 02-Mar-2018 21:25:18
Advertisements