For a given array whose element values are randomly picked from single-digit integers `0` to `9`, return an array with the same digit order but all `0`'s paired. Paring two `0`'s generates one `0` at the location of the first.

Ex:
```python
pair_zeros([0, 1, 0, 2])
# paired: ^-----^ cull second zero
       == [0, 1, 2];
#   kept: ^

pair_zeros([0, 1, 0, 0])
# paired: ^-----^
       == [0, 1,    0];
#   kept: ^

pair_zeros([1, 0, 7, 0, 1])
# paired:    ^-----^
       == [1, 0, 7,    1];
#   kept:    ^

pair_zeros([0, 1, 7, 0, 2, 2, 0, 0, 1, 0])
# paired: ^--------^ 
#        [0, 1, 7,    2, 2, 0, 0, 1, 0]
#   kept: ^         paired: ^--^
       == [0, 1, 7,    2, 2, 0,    1, 0];
#   kept:                   ^
```

Here are the 2 important rules:

1. Pairing happens from left to right in the array. However, for each pairing, the "second" `0` will always be paired towards the first (right to left)
2. `0`'s generated by pairing can NOT be paired again

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def pair_zeros(arr):
	

Solutions:
from itertools import count

def pair_zeros(arr, *args):
	c = count(1)
	return [elem for elem in arr if elem != 0 or next(c) % 2]


def pair_zeros(nums, *_):
	result = []
	skip_zero = False
	for a in nums:
		if a == 0:
			if not skip_zero:
				result.append(a)
			skip_zero = not skip_zero
		else:
			result.append(a)
	return result


def pair_zeros(arr):
	got = [0]
	return [v for v in arr if v or got.__setitem__(0, got[0] ^ 1) or got[0]]


def pair_zeros(arr):
	return [d for (i, d) in enumerate(arr) if d != 0 or arr[:i + 1].count(0) % 2]


def pair_zeros(arr):
	lst = []
	flag = False
	for i in arr:
		if i == 0:
			if not flag:
				lst.append(i)
			flag = not flag
		else:
			lst.append(i)
	return lst


import itertools

def pair_zeros(arr):
	it = itertools.count(1)
	return [x for x in arr if x > 0 or next(it) % 2]


def pair_zeros(arr, *other):
	return [n for (i, n) in enumerate(arr) if n != 0 or arr[:i + 1].count(0) % 2 == 1]


import re

def pair_zeros(arr, *args):
	return list(map(int, re.sub('(0[^0]*)0', '\\1', ''.join([str(a) for a in arr]))))


def pair_zeros(arr):
	lst = []
	zCount = 0
	for item in arr:
		if item == 0:
			zCount += 1
			if zCount % 2 != 0:
				lst.append(item)
		else:
			lst.append(item)
	return lst