I have a potentially long array of one's and zero's that looks like this:
a = [0,0,1,0,1,0,.....]
I want to translate each consecutive pair of values to an integer between 0 & 3 as shown below:
- 0,0 -> 0
- 0,1 -> 1
- 1,0 -> 3
- 1,1 -> 2
I'm looking for a nice clean efficient way to create the array b (example output below) using the mapping above:
b = [0, 3, 3,...]
Is a dict a good idea? I can't figure out how to do it though.