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: 
Here's a further difference, which had me puzzled for a while just now: because `&` (and other bitwise operators) have a higher precedence than `and` (and other boolean operators) the following expressions evaluate to different values:

```
0 < 1 & 0 < 2

```

versus

```
0 < 1 and 0 < 2

```

To wit, the first yields `False` as it is equivalent to `0 < (1 & 0) < 2`, hence `0 < 0 < 2`, hence `0 < 0 and 0 < 2`.
**Boolean 'and' vs. Bitwise '&':**

Pseudo-code/Python helped me understand the difference between these:

```
def boolAnd(A, B):
    # boolean 'and' returns either A or B
    if A == False:
        return A
    else:
        return B

def bitwiseAnd(A , B):
    # binary representation (e.g. 9 is '1001', 1 is '0001', etc.)

    binA = binary(A)
    binB = binary(B)

    # perform boolean 'and' on each pair of binaries in (A, B)
    # then return the result:
    # equivalent to: return ''.join([x*y for (x,y) in zip(binA, binB)])

    # assuming binA and binB are the same length
    result = []
    for i in range(len(binA)):
      compar = boolAnd(binA[i], binB[i]) 
      result.append(compar)

    # we want to return a string of 1s and 0s, not a list

    return ''.join(result)

```