Skip to content

Commit

Permalink
Bit arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
seanjtaylor committed Feb 11, 2012
1 parent f8c5607 commit c24eb14
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bitarrays.py
@@ -0,0 +1,14 @@

# Bit arrays

def ba_and(x, y):
return [i and j for i, j in zip(x, y)]

def test_ba_and():
assert ba_and([0,1,0,1],[1,0,0,1]) == [0,0,0,1]

def ba_or(x, y):
return [i or j for i, j in zip(x, y)]

def test_ba_or():
assert ba_or([0,1,0,1],[1,0,0,1]) == [1,1,0,1]

0 comments on commit c24eb14

Please sign in to comment.