Question: I am confused as to when I should use Boolean vs bitwise operators

* `and` vs `&`
* `or` vs `|`

Could someone enlighten me as to when do i use each and when will using one over the other affect my results?

Answer: 
If you are trying to do element-wise boolean operations in `numpy`, the answer is somewhat different. You can use `&` and `|` for element-wise boolean operations, but `and` and `or` will return value error.

To be on the safe side, you can use the [numpy logic functions](http://docs.scipy.org/doc/numpy/reference/routines.logic.html).

```
np.array([True, False, True]) | np.array([True, False, False])
# array([ True, False,  True], dtype=bool)

np.array([True, False, True]) or np.array([True, False, False])
# ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

np.logical_or(np.array([True, False, True]), np.array([True, False, False]))
# array([ True, False,  True], dtype=bool)

```
Boolean operation are logical operations.

Bitwise operations are operations on binary bits.

Bitwise operations:

```
>>> k = 1
>>> z = 3
>>> k & z  
1
>>> k | z  
3

```

The operations:

* AND `&`: 1 if both bits are 1, otherwise 0
* OR `|`: 1 if either bit is 1, otherwise 0
* XOR `^`: 1 if the bits are different, 0 if they're the same
* NOT `~`': Flip each bit

Some of the uses of bitwise operations:

1. Setting and Clearing Bits

Boolean operations:

```
>>> k = True
>>> z = False
>>> k & z  # and
False
>>> k | z  # or
True
>>> 

```