Overview:
-
Bitwise OR operation compares the bit pattern of two operands. A pair of bits are taken from each operand and the OR operation is applied. If both the bits are zero than the resultant bit is zero. If any of the bits is one than the resultant bit is one.
-
The bitwise_or() function of NumPy module applies bitwise OR between the integer elements of two array-like instances and returns the results as an ndarray.
Example:
# Example Python program that does a bitwise # For a given number return the binary number # Number and Masks maskArray = numpy.ndarray(shape = (1,3), dtype = numpy.int32) # Do bitwise OR # Print results |
Output:
['010100' '011001' '011110'] ['000011' '000101' '000110'] ['010111' '011101' '011110'] |