In this chapter, we will discuss about NumPy bitwise or. The bitwise OR operation on the corresponding bits of binary representations of integers in input arrays is computed by the np.bitwise_or() function.
Example Of NumPy bitwise or
import numpy as np a,b = 13,17 print 'Binary equivalents of 13 and 17:' print bin(a), bin(b) print 'Bitwise OR of 13 and 17:' print np.bitwise_or(13, 17)
Its output is as follows −
Binary equivalents of 13 and 17: 0b1101 0b10001 Bitwise OR of 13 and 17: 29
You can verify this output using the following table. Consider the following Bitwise OR truth table.
A | B | OR |
---|---|---|
1 | 1 | 1 |
1 | 0 | 1 |
0 | 1 | 1 |
0 | 0 | 0 |
1 | 1 | 0 | 1 | ||
AND | |||||
1 | 0 | 0 | 0 | 1 | |
result | 1 | 1 | 1 | 0 | 1 |
The decimal equivalent of 11101 is 29.
Next Topic – Click Here
Pingback: NumPy - Binary Operators - Adglob Infosystem Pvt Ltd
Pingback: NumPy - invert - Adglob Infosystem Pvt Ltd............
Pingback: NumPy char multiply - Adglob Infosystem Pvt Ltd ....
Pingback: NumPy char center - Adglob Infosystem Pvt Ltd .....
Pingback: NumPy char capitalize - Adglob Infosystem Pvt Ltd
Pingback: NumPy char title - Adglob Infosystem Pvt Ltd .........
Pingback: NumPy char lower - Adglob Infosystem Pvt Ltd ......
Pingback: NumPy char upper - Adglob Infosystem Pvt Ltd ......
Pingback: NumPy char split - Adglob Infosystem Pvt Ltd .........
Pingback: NumPy char splitlines - Adglob Infosystem Pvt Ltd ...
Pingback: NumPy char strip - Adglob Infosystem Pvt Ltd ........
Pingback: NumPy char join - Adglob Infosystem Pvt Ltd .........
Pingback: NumPy char replace - Adglob Infosystem Pvt Ltd ...
Pingback: NumPy char decode - Adglob Infosystem Pvt Ltd ....
Pingback: NumPy char encode - Adglob Infosystem Pvt Ltd ....
Pingback: NumPy Mathematical Functions - Adglob Infosystem Pvt Ltd
Pingback: NumPy Arithmetic Operations - Adglob Infosystem Pvt Ltd
Pingback: NumPy - Statistical Functions - Adglob Infosystem Pvt Ltd
Pingback: NumPy - Sort Search & Counting Functions - Adglob Infosystem Pvt Ltd
Pingback: NumPy - Byte Swapping - Adglob Infosystem Pvt Ltd
Pingback: NumPy-dot - Adglob Infosystem Pvt Ltd ...................
Pingback: NumPy-vdot - Adglob Infosystem Pvt Ltd .................
Pingback: NumPy-inner - Adglob Infosystem Pvt Ltd ...............
Pingback: NumPy-matmul - Adglob Infosystem Pvt Ltd ...........
Pingback: NumPy - Determinant - Adglob Infosystem Pvt Ltd ...
Pingback: NumPy-linalg solve - Adglob Infosystem Pvt Ltd ......
Pingback: NumPy-linalg inverse - Adglob Infosystem Pvt Ltd ....
Pingback: NumPy - Matplotlib - Adglob Infosystem Pvt Ltd ......
Pingback: NumPy - Histogram Using Matplotlib - Adglob Infosystem Pvt Ltd
Pingback: NumPy - with I/O - Adglob Infosystem Pvt Ltd .........
Pingback: NumPy - swap axes - Adglob Infosystem Pvt Ltd .....
Pingback: NumPy - vsplit - Adglob Infosystem Pvt Ltd
Pingback: NumPy - unique - Adglob Infosystem Pvt Ltd
Pingback: NumPy - bitwise and - Adglob Infosystem Pvt Ltd .......